crepererum commented on code in PR #9025:
URL: https://github.com/apache/arrow-datafusion/pull/9025#discussion_r1469361209
##########
datafusion/execution/src/memory_pool/proxy.rs:
##########
@@ -54,12 +60,15 @@ impl<T> VecAllocExt for Vec<T> {
}
}
-/// Extension trait for [`RawTable`] to account for allocations.
+/// Extension trait for hash browns [`RawTable`] to account for allocations.
pub trait RawTableAllocExt {
/// Item type.
type T;
- /// [Insert](RawTable::insert) new element into table and store additional
allocated bytes in `accounting` (additive).
+ /// [Insert](RawTable::insert) new element into table and increase
+ /// `accounting` by any newly allocated bytes.
+ ///
+ /// Returns the bucket where the element was inserted.
Review Comment:
TBH this design is "good enough", but we should probably add some examples
at some point (doesn't have to be in this PR though). Same is actually true for
the other trait.
##########
datafusion/execution/src/memory_pool/mod.rs:
##########
@@ -107,9 +108,13 @@ pub trait MemoryPool: Send + Sync + std::fmt::Debug {
fn reserved(&self) -> usize;
}
-/// A memory consumer that can be tracked by [`MemoryReservation`] in
-/// a [`MemoryPool`]. All allocations are registered to a particular
-/// `MemoryConsumer`;
+/// A memory consumer is a named allocation traced by a particular
+/// [`MemoryReservation`] in a [`MemoryPool`]. All allocations are registered
to
+/// a particular `MemoryConsumer`;
+///
+/// For help with allocation accounting, see the [proxy] module.
+///
+/// [proxy]: crate::memory_pool::proxy
Review Comment:
IIRC we once had an actual proxy object that could be used to represent the
memory for another more complex data structure, but this design was since
changed. So only the helper traits remain, which I think should be under
`utils` or `extensions`. So feel free to move them.
--
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]