feat(memory-tracking): implement arrow_buffer::MemoryPool for MemoryPool#18928
Open
notfilippo wants to merge 3 commits intoapache:mainfrom
Open
feat(memory-tracking): implement arrow_buffer::MemoryPool for MemoryPool#18928notfilippo wants to merge 3 commits intoapache:mainfrom
notfilippo wants to merge 3 commits intoapache:mainfrom
Conversation
notfilippo
commented
Nov 25, 2025
| parquet_encryption = [ | ||
| "parquet/encryption", | ||
| ] | ||
| arrow_buffer_pool = [ |
Member
Author
There was a problem hiding this comment.
The feature-flag name is fairly descriptive. Maybe we could change it to something better. I'm open to suggestions!
Comment on lines
+51
to
+67
| fn available(&self) -> isize { | ||
| // The pool may be overfilled, so this method might return a negative value. | ||
| (self.capacity() as i128 - self.used() as i128) | ||
| .try_into() | ||
| .unwrap_or(isize::MIN) | ||
| } | ||
|
|
||
| fn used(&self) -> usize { | ||
| self.inner.reserved() | ||
| } | ||
|
|
||
| fn capacity(&self) -> usize { | ||
| match self.inner.memory_limit() { | ||
| MemoryLimit::Infinite | MemoryLimit::Unknown => usize::MAX, | ||
| MemoryLimit::Finite(capacity) => capacity, | ||
| } | ||
| } |
Member
Author
There was a problem hiding this comment.
I'm not really sure these methods have a use-case... I'm open to removing them in the upstream trait.
kosiew
approved these changes
Jan 19, 2026
Contributor
kosiew
left a comment
There was a problem hiding this comment.
LGTM
Left a non-blocking suggestion.
|
|
||
| #[test] | ||
| pub fn can_claim_array() { | ||
| let pool = Arc::new(UnboundedMemoryPool::default()); |
Contributor
There was a problem hiding this comment.
how about adding tests for the MemoryLimit::Finite branch too?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Related to #16841. The ability to correctly account for memory usage of arrow buffers in execution nodes is crucial to maximise resource usage while preventing OOMs.
What changes are included in this PR?
arrow_buffer_poolfeature-flagAre these changes tested?
Yes!
Are there any user-facing changes?
Introduced new API.