tustvold opened a new issue, #4328:
URL: https://github.com/apache/arrow-datafusion/issues/4328

   **Describe the bug**
   
   `MemoryConsumer::try_grow` calls through to 
`MemoryManager::can_grow_directly` which determines the remaining space by 
performing `self.pool_size - trk_total`.
   
   This can potentially underflow if the tracked memory exceeds the pool size, 
something for which there is no protection.
   
   **To Reproduce**
   
   
   ```
   #[test]
   fn test_underflow() {
       let config = MemoryManagerConfig::try_new_limit(100, 0.5).unwrap();
       let manager = MemoryManager::new(config);
       manager.grow_tracker_usage(100);
   
       manager.register_requester(&MemoryConsumerId::new(1));
       assert!(!manager.can_grow_directly(20, 0));
   }
   ```
   
   **Expected behavior**
   
   
   **Additional context**
   
   


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

Reply via email to