@@ -127,6 +127,12 @@ impl PartialEq<FrozenHeapRef> for FrozenHeapRef {
127127impl Eq for FrozenHeapRef { }
128128
129129impl FrozenHeapRef {
130+ /// Number of bytes allocated on this heap, not including any memory
131+ /// represented by [`extra_memory`](crate::values::StarlarkValue::extra_memory).
132+ pub fn allocated_bytes ( & self ) -> usize {
133+ self . 0 . arena . allocated_bytes ( )
134+ }
135+
130136 /// Obtain a summary of how much memory is currently allocated by this heap.
131137 /// Doesn't include the heaps it keeps alive by reference.
132138 pub fn allocated_summary ( & self ) -> HeapSummary {
@@ -192,6 +198,12 @@ impl FrozenHeap {
192198 self . alloc_raw ( simple ( val) )
193199 }
194200
201+ /// Number of bytes allocated on this heap, not including any memory
202+ /// represented by [`extra_memory`](crate::values::StarlarkValue::extra_memory).
203+ pub fn allocated_bytes ( & self ) -> usize {
204+ self . arena . allocated_bytes ( )
205+ }
206+
195207 /// Obtain a summary of how much memory is currently allocated by this heap.
196208 pub fn allocated_summary ( & self ) -> HeapSummary {
197209 self . arena . allocated_summary ( )
@@ -271,10 +283,13 @@ impl Heap {
271283 Self :: default ( )
272284 }
273285
274- pub ( crate ) fn allocated_bytes ( & self ) -> usize {
286+ /// Number of bytes allocated on this heap, not including any memory
287+ /// represented by [`extra_memory`](crate::values::StarlarkValue::extra_memory).
288+ pub fn allocated_bytes ( & self ) -> usize {
275289 self . arena . borrow ( ) . allocated_bytes ( )
276290 }
277291
292+ /// Only those allocated on the inline heap (mostly strings)
278293 pub ( crate ) fn allocated_bytes_inline ( & self ) -> usize {
279294 self . arena . borrow ( ) . allocated_bytes_inline ( )
280295 }
0 commit comments