You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/24 08:10:47 UTC

[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4351: Add check to avoid underflow in memory manager

tustvold commented on code in PR #4351:
URL: https://github.com/apache/arrow-datafusion/pull/4351#discussion_r1031166364


##########
datafusion/core/src/execution/memory_manager/mod.rs:
##########
@@ -330,7 +330,11 @@ impl MemoryManager {
 
     fn max_mem_for_requesters(&self) -> usize {
         let trk_total = self.get_tracker_total();
-        self.pool_size - trk_total
+        if trk_total < self.pool_size {
+            self.pool_size - trk_total
+        } else {
+            0_usize
+        }

Review Comment:
   ```suggestion
           self.pool_size.saturating_sub(trk_total)
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org