This is an automated email from the ASF dual-hosted git repository.
hongze pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new f7716451c7 [GLUTEN-9383][VL] Fix leak when growing capacity (#9424)
f7716451c7 is described below
commit f7716451c7a9f094b54429716abf171d0a352941
Author: Zhen Wang <[email protected]>
AuthorDate: Mon Apr 28 20:58:18 2025 +0800
[GLUTEN-9383][VL] Fix leak when growing capacity (#9424)
---
cpp/velox/memory/VeloxMemoryManager.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cpp/velox/memory/VeloxMemoryManager.cc
b/cpp/velox/memory/VeloxMemoryManager.cc
index 78680957c3..c8eec9dde8 100644
--- a/cpp/velox/memory/VeloxMemoryManager.cc
+++ b/cpp/velox/memory/VeloxMemoryManager.cc
@@ -168,7 +168,13 @@ class ListenableArbitrator : public
velox::memory::MemoryArbitrator {
}
auto reclaimedFreeBytes = shrinkPool(pool, 0);
auto neededBytes = velox::bits::roundUp(bytes - reclaimedFreeBytes,
memoryPoolTransferCapacity_);
- listener_->allocationChanged(neededBytes);
+ try {
+ listener_->allocationChanged(neededBytes);
+ } catch (const std::exception& e) {
+ // if allocationChanged failed, we need to free the reclaimed bytes
+ listener_->allocationChanged(-reclaimedFreeBytes);
+ throw e;
+ }
auto ret = growPool(pool, reclaimedFreeBytes + neededBytes, bytes);
VELOX_CHECK(
ret,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]