pub struct HeapStats {
pub committed: usize,
pub reserved: usize,
pub malloc_requested: usize,
pub pages: usize,
pub pages_abandoned: usize,
pub heaps: usize,
pub theaps: usize,
pub purged: usize,
pub detailed: bool,
}Expand description
Exact allocator counters accompanying a ProfStats reading.
These come from mimalloc v3’s per-heap statistics
(mi_heap_stats_get/mi_subproc_stats_get), which the v2 engine did not
expose. They are valid even when the profiler is stopped.
Fields§
§committed: usizeBytes currently committed from the OS.
reserved: usizeBytes currently reserved from the OS (always >= committed).
malloc_requested: usizeBytes the application actually requested and still holds.
Only maintained when the C library was built with MI_STAT >= 2;
otherwise this is 0. Check HeapStats::detailed before using it.
pages: usizeLive mimalloc pages.
pages_abandoned: usizePages abandoned by exited threads.
heaps: usizeLive first-class heaps.
theaps: usizeLive thread-local heaps. The main thread’s statically-initialized theap is not counted, so a single-threaded process reports 0.
purged: usizeCumulative bytes purged back to the OS.
detailed: boolWhether the C library was built with MI_STAT >= 2 (“detailed”
statistics), which upstream enables by default only for debug
builds. HeapStats::malloc_requested is maintained only at that
level; every other field here is maintained at any level.
Without this flag you cannot tell “the application allocated nothing” from “this build does not track that counter”.