Recreate fbb to avoid memory leak of FlatBuffers.

This commit is contained in:
ZPaC 2021-08-21 16:22:12 +08:00
parent 7c7237ad81
commit 031c96360d
2 changed files with 3 additions and 1 deletions

View File

@ -91,6 +91,8 @@ class FusedPullWeightKernel : public CPUKernel {
fl_iteration_ = pull_weight_rsp->iteration();
MS_LOG(DEBUG) << "Server is not ready for downloading yet. Reason: " << pull_weight_rsp->reason()->str()
<< ". Retry later.";
// Recreate fbb to avoid memory leak of FlatBuffers.
fbb = std::make_shared<fl::FBBuilder>();
if (!BuildPullWeightReq(fbb)) {
MS_LOG(EXCEPTION) << "Building request for FusedDownloadWeightsByKeys failed.";
return false;

View File

@ -190,7 +190,7 @@ bool Server::InitCommunicatorWithWorker() {
MS_EXCEPTION_IF_NULL(http_comm);
communicators_with_worker_.push_back(http_comm);
}
g_communicator_with_worker = communicator_with_worker_;
g_communicators_with_worker = communicators_with_worker_;
return true;
}