Skip to content

Commit fc025f5

Browse files
authored
Fix memory leak of pserver (#10173)
1 parent 44bb5df commit fc025f5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

paddle/fluid/operators/detail/sendrecvop_utils.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ void SerializeToByteBuffer(const std::string& name, framework::Variable* var,
3939
// parallelism execution, need to know when to free the tensor.
4040
DestroyCallback destroy_callback = [](void* backing) {};
4141

42-
void* buf = malloc(1024);
42+
auto buffer = std::unique_ptr<char[]>(new char[1024]);
43+
void* buf = buffer.get();
44+
4345
void* payload = nullptr;
4446
size_t payload_size;
4547
ProtoEncodeHelper e(static_cast<char*>(buf), 1024);

0 commit comments

Comments
 (0)