@@ -127,6 +127,12 @@ impl PartialEq<FrozenHeapRef> for FrozenHeapRef {
127
127
impl Eq for FrozenHeapRef { }
128
128
129
129
impl 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
+
130
136
/// Obtain a summary of how much memory is currently allocated by this heap.
131
137
/// Doesn't include the heaps it keeps alive by reference.
132
138
pub fn allocated_summary ( & self ) -> HeapSummary {
@@ -192,6 +198,12 @@ impl FrozenHeap {
192
198
self . alloc_raw ( simple ( val) )
193
199
}
194
200
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
+
195
207
/// Obtain a summary of how much memory is currently allocated by this heap.
196
208
pub fn allocated_summary ( & self ) -> HeapSummary {
197
209
self . arena . allocated_summary ( )
@@ -271,10 +283,13 @@ impl Heap {
271
283
Self :: default ( )
272
284
}
273
285
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 {
275
289
self . arena . borrow ( ) . allocated_bytes ( )
276
290
}
277
291
292
+ /// Only those allocated on the inline heap (mostly strings)
278
293
pub ( crate ) fn allocated_bytes_inline ( & self ) -> usize {
279
294
self . arena . borrow ( ) . allocated_bytes_inline ( )
280
295
}
0 commit comments