pub struct MemoryStats {Show 28 fields
pub current_mapped_bytes: usize,
pub peak_mapped_bytes: usize,
pub map_calls: usize,
pub unmap_calls: usize,
pub page_reset_calls: usize,
pub page_reset_bytes: usize,
pub guard_install_calls: usize,
pub guard_install_bytes: usize,
pub retained_free_segments: usize,
pub max_retained_free_segments: usize,
pub retained_free_bytes: usize,
pub purged_segments: usize,
pub purge_calls: usize,
pub purged_bytes: usize,
pub reset_segments: usize,
pub reset_calls: usize,
pub retained_huge_blocks: usize,
pub retained_huge_bytes: usize,
pub current_thread_live_allocations: usize,
pub current_thread_owned_segments: usize,
pub cross_thread_reclaimed_blocks: usize,
pub page_refills: usize,
pub recycled_pages: usize,
pub fresh_pages: usize,
pub fresh_segments: usize,
pub orphan_segments_adopted: usize,
pub recycle_sweeps: usize,
pub size_class_occupancy: [SizeClassOccupancy; 52],
}Expand description
Snapshot of Mnemosyne memory mapping and segment cache state.
Fields§
§current_mapped_bytes: usizeAddress space currently mapped from the OS, in bytes. Reserved space, not resident: a range stays counted after its physical backing is released, because the mapping is still held.
peak_mapped_bytes: usizeHigh-water mark of Self::current_mapped_bytes.
map_calls: usizeSuccessful map requests to the OS.
unmap_calls: usizeSuccessful unmap requests to the OS.
page_reset_calls: usizeNumber of confirmed backend page_reset calls (Linux MADV_DONTNEED,
macOS/FreeBSD MADV_FREE, Windows VirtualAlloc(MEM_RESET)).
page_reset_bytes: usizeCumulative byte count passed to confirmed page_reset calls.
guard_install_calls: usizeNumber of confirmed backend make_guard calls (Unix mprotect(PROT_NONE),
Windows VirtualProtect(PAGE_NOACCESS)).
guard_install_bytes: usizeCumulative byte count passed to confirmed make_guard calls.
retained_free_segments: usizeFree segments held in the cache for reuse instead of unmapped.
max_retained_free_segments: usizeCap on Self::retained_free_segments; segments beyond it are
purged rather than retained.
retained_free_bytes: usizeBytes represented by the retained free segments.
purged_segments: usizeSegments returned to the OS by decay.
purge_calls: usizeDecay purge passes performed.
purged_bytes: usizeBytes returned to the OS by those purges.
reset_segments: usizeNumber of segments whose physical backing was released by a
confirmed page_reset while the segment itself remained cached
in the retained pool.
reset_calls: usizeNumber of reset_segment_pool invocations.
retained_huge_blocks: usizeNumber of huge blocks currently retained in the huge-allocation cache across all NUMA nodes.
retained_huge_bytes: usizeTotal bytes of huge blocks currently retained in the huge-allocation cache across all NUMA nodes.
current_thread_live_allocations: usizeAllocations currently handed out by the calling thread.
current_thread_owned_segments: usizeSegments the calling thread owns and allocates from without coordination.
cross_thread_reclaimed_blocks: usizeBlocks freed by another thread and drained back into this thread’s pages.
page_refills: usizeTimes a size class exhausted its page and acquired another; the sum of the three sources below.
recycled_pages: usizeRefills served from an already-held empty page, the cheapest outcome.
fresh_pages: usizeRefills that carved a new page from an owned segment.
fresh_segments: usizeRefills that needed a new segment, the only source reaching the OS backend.
orphan_segments_adopted: usizeSegments inherited from threads that exited still owning them, which keeps their memory reusable rather than stranded.
recycle_sweeps: usizeDecay-sweep passes over pages looking for empties to recycle.
Against Self::recycled_pages this shows whether sweeping is
paying for itself or scanning without finding reusable pages.
size_class_occupancy: [SizeClassOccupancy; 52]Per-size-class occupancy for the calling thread, indexed by size class.
Implementations§
Source§impl MemoryStats
impl MemoryStats
Sourcepub fn to_json_with_bins(&self, bins: &[BinSnapshot]) -> String
pub fn to_json_with_bins(&self, bins: &[BinSnapshot]) -> String
Serializes this snapshot plus per-bin counters to a JSON string.
Use crate::stats::memory_stats_json for a convenient one-call version that
captures the current stats automatically.