wForget commented on code in PR #9424:
URL: https://github.com/apache/incubator-gluten/pull/9424#discussion_r2065245194
##########
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;
Review Comment:
Is it ok like this?
```
try {
listener_->allocationChanged(neededBytes);
} catch (const std::exception&) {
// if allocationChanged failed, we need to free the reclaimed bytes
listener_->allocationChanged(-reclaimedFreeBytes);
std::rethrow_exception(std::current_exception());
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]