pub struct JemallocStats {
pub allocated_bytes: u64,
pub active_bytes: u64,
pub metadata_bytes: u64,
pub resident_bytes: u64,
pub mapped_bytes: u64,
pub retained_bytes: u64,
}Expand description
Snapshot of jemalloc’s process-wide accounting at one tick. All
values are bytes. Definitions match the stats.* mallctl namespace
(see jemalloc(3)).
Fields§
§allocated_bytes: u64Bytes currently held by live application allocations
(stats.allocated). The closest thing to “what is the live heap
from the program’s point of view”. If this grows monotonically
across runs while caches stay flat, the program is holding more
memory.
active_bytes: u64Bytes in active jemalloc extents (stats.active). Always
>= allocated_bytes; the delta is fragmentation within active
extents.
metadata_bytes: u64Bytes used by jemalloc’s own metadata structures
(stats.metadata).
resident_bytes: u64jemalloc’s resident-set estimate (stats.resident): active +
retained-but-resident + metadata, in pages.
mapped_bytes: u64Total virtual memory mapped by jemalloc (stats.mapped).
retained_bytes: u64Virtual memory retained by jemalloc after decommit
(stats.retained). This is the bucket that explains “process
RSS stays high after a workload finishes” — pages were
returned to jemalloc but jemalloc has not yet returned them to
the kernel. Controlled by dirty_decay_ms / muzzy_decay_ms
in MALLOC_CONF.
Implementations§
Source§impl JemallocStats
impl JemallocStats
Sourcepub fn observed_usage_bytes(self, process_bytes: u64) -> u64
pub fn observed_usage_bytes(self, process_bytes: u64) -> u64
Conservatively reconcile process-wide and allocator measurements.
These are overlapping views, so take their maximum rather than adding them or allowing a smaller allocator reading to hide other memory.