Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak of pserver #10173

Merged
merged 3 commits into from
Apr 24, 2018
Merged

Conversation

gongweibao
Copy link
Contributor

Fix #10155

Copy link
Contributor

@typhoonzero typhoonzero left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks for finding this bug, it should be hard.

@@ -39,7 +39,9 @@ void SerializeToByteBuffer(const std::string& name, framework::Variable* var,
// parallelism execution, need to know when to free the tensor.
DestroyCallback destroy_callback = [](void* backing) {};

void* buf = malloc(1024);
auto buffer = std::unique_ptr<char[]>(new char[1024]);
Copy link
Contributor

@panyx0718 panyx0718 Apr 24, 2018

Choose a reason for hiding this comment

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

I think it's ok for now. Is it possible to statically create it? Maybe it's faster?
char char_buf[1024];
void* buffer = static_cast<void*>(char_buf)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe it change to be larger later? ^_^

@gongweibao gongweibao merged commit fc025f5 into PaddlePaddle:develop Apr 24, 2018
@gongweibao gongweibao deleted the fixmemleak branch April 25, 2018 07:05
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.

None yet

3 participants