Skip to content

Commit

Permalink
Add error log in ~MemoryManager (#8262)
Browse files Browse the repository at this point in the history
Summary:
When leak check flag is false, we shall print the error message.

Pull Request resolved: #8262

Reviewed By: xiaoxmeng

Differential Revision: D52546224

Pulled By: tanjialiang

fbshipit-source-id: d7f15d1e4403bc4849c61b85d7fdfffcfef601dd
  • Loading branch information
tanjialiang authored and facebook-github-bot committed Jan 5, 2024
1 parent 8ff2246 commit 8321b3e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions velox/common/memory/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,18 @@ MemoryManager::MemoryManager(const MemoryManagerOptions& options)
}

MemoryManager::~MemoryManager() {
if (checkUsageLeak_) {
VELOX_CHECK_EQ(
if (pools_.size() != 0) {
const auto errMsg = fmt::format(
"pools_.size() != 0 ({} vs {}). There are unexpected alive memory "
"pools allocated by user on memory manager destruction:\n{}",
pools_.size(),
0,
"There are unexpected alive memory pools allocated by user on memory manager destruction:\n{}",
toString(true));
if (checkUsageLeak_) {
VELOX_FAIL(errMsg);
} else {
LOG(ERROR) << errMsg;
}
}
}

Expand Down

0 comments on commit 8321b3e

Please sign in to comment.