Skip to content

Commit 99e2804

Browse files
authored
[Serving] Fix memory leak when update full model in serving. (#809)
Signed-off-by: Tao Peng <jiankeng.pt@alibaba-inc.com>
1 parent 772ca11 commit 99e2804

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tensorflow/core/common_runtime/direct_session_group.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ DirectSessionGroup::DirectSessionGroup()
2626
DirectSessionGroup::DirectSessionGroup(
2727
ResourceMgr* cpu_mgr, ResourceMgr* gpu_mgr)
2828
: cpu_shared_resource_mgr_(cpu_mgr) {
29-
gpu_shared_resource_mgrs_.emplace_back(gpu_mgr);
29+
if (gpu_mgr) {
30+
gpu_shared_resource_mgrs_.emplace_back(gpu_mgr);
31+
}
3032
leader_session_ids_.emplace_back(0);
3133
}
3234

tensorflow/core/common_runtime/local_device.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void LocalDevice::Init(const SessionOptions& options,
159159
tp_info = global_tp_info_[numa_node];
160160
} else {
161161
if (opt.global_threadpool_num > 1) {
162-
for (int i = 0; i < opt.global_threadpool_num; ++i) {
162+
while (opt.global_threadpool_num > global_tp_info_.size()) {
163163
global_tp_info_.push_back(nullptr);
164164
}
165165
if (!global_tp_info_[opt.device_threadpool_index]) {

0 commit comments

Comments
 (0)