wForget commented on code in PR #9424:
URL: https://github.com/apache/incubator-gluten/pull/9424#discussion_r2065239351


##########
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:
   > We should use `throw;` instead of `throw e;`. 
   
   Thank you, I will send a follow up PR to change it
   
   > Otherwise the original exception type will be cast down to 
`std::exception`.
   
   Sorry, I'm not familiar with c++, could this cause any problems? how can I 
handle it?



-- 
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]

Reply via email to