Skip to content

Conversation

@wanghaoshuang
Copy link
Contributor

@wanghaoshuang wanghaoshuang commented May 3, 2018

fix #10254
for_test=True at here
will lead to memory leak while inference is active. Reference assignment would be more suitable
than the pointer assignment
here.

@wanghaoshuang wanghaoshuang requested review from Xreki and kexinzhao May 3, 2018 01:38
kexinzhao
kexinzhao previously approved these changes May 4, 2018
Copy link
Contributor

@kexinzhao kexinzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for fixing this!

def inference_optimize(self):
res = Program()
res.desc = core.inference_optimize(self.desc)
res.desc = core.ProgramDesc(self.desc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我感觉为什么core.inference_optimize的实现有memory leak,原因还不是很确定。这里加个comment说明一下吧,说明这里的功能和core.inference_optimize是一样的以及为什么不用core.inference_optimize的原因吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

暂时还不确定core.inference_optimize导致memory leak的原因,我加了个comment说明这里的功能和core.inference_optimize一样

p.desc = core.inference_optimize(self.desc)
else:
p.desc = core.ProgramDesc(self.desc)
for i in xrange(p.desc.num_blocks()):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以调Python的inference_optimize吗?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wanghaoshuang 觉得这里可以直接调用Python里的: def inference_optimize(self),另外,直接在Python里修正attr is_test=True后,有打印看下inference_program检查过吗?is_test是否变过来了?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以调Python的inference_optimize吗?

Fixed. Thx.

直接在Python里修正attr is_test=True后,有打印看下inference_program检查过吗?is_test是否变过来了?

嗯,已经验证了。

Copy link
Contributor

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@wanghaoshuang wanghaoshuang merged commit f43b71b into PaddlePaddle:develop May 7, 2018
@wanghaoshuang wanghaoshuang deleted the fix_program_clone branch May 20, 2022 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OCR效果ok但在申请了约200G内存的情况下出现内存泄漏,导致任务挂掉

4 participants