Skip to main content

MemoryStats

Struct MemoryStats 

Source
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: usize

Address 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: usize

High-water mark of Self::current_mapped_bytes.

§map_calls: usize

Successful map requests to the OS.

§unmap_calls: usize

Successful unmap requests to the OS.

§page_reset_calls: usize

Number of confirmed backend page_reset calls (Linux MADV_DONTNEED, macOS/FreeBSD MADV_FREE, Windows VirtualAlloc(MEM_RESET)).

§page_reset_bytes: usize

Cumulative byte count passed to confirmed page_reset calls.

§guard_install_calls: usize

Number of confirmed backend make_guard calls (Unix mprotect(PROT_NONE), Windows VirtualProtect(PAGE_NOACCESS)).

§guard_install_bytes: usize

Cumulative byte count passed to confirmed make_guard calls.

§retained_free_segments: usize

Free segments held in the cache for reuse instead of unmapped.

§max_retained_free_segments: usize

Cap on Self::retained_free_segments; segments beyond it are purged rather than retained.

§retained_free_bytes: usize

Bytes represented by the retained free segments.

§purged_segments: usize

Segments returned to the OS by decay.

§purge_calls: usize

Decay purge passes performed.

§purged_bytes: usize

Bytes returned to the OS by those purges.

§reset_segments: usize

Number of segments whose physical backing was released by a confirmed page_reset while the segment itself remained cached in the retained pool.

§reset_calls: usize

Number of reset_segment_pool invocations.

§retained_huge_blocks: usize

Number of huge blocks currently retained in the huge-allocation cache across all NUMA nodes.

§retained_huge_bytes: usize

Total bytes of huge blocks currently retained in the huge-allocation cache across all NUMA nodes.

§current_thread_live_allocations: usize

Allocations currently handed out by the calling thread.

§current_thread_owned_segments: usize

Segments the calling thread owns and allocates from without coordination.

§cross_thread_reclaimed_blocks: usize

Blocks freed by another thread and drained back into this thread’s pages.

§page_refills: usize

Times a size class exhausted its page and acquired another; the sum of the three sources below.

§recycled_pages: usize

Refills served from an already-held empty page, the cheapest outcome.

§fresh_pages: usize

Refills that carved a new page from an owned segment.

§fresh_segments: usize

Refills that needed a new segment, the only source reaching the OS backend.

§orphan_segments_adopted: usize

Segments inherited from threads that exited still owning them, which keeps their memory reusable rather than stranded.

§recycle_sweeps: usize

Decay-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

Source

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.

Trait Implementations§

Source§

impl Clone for MemoryStats

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MemoryStats

Source§

impl Debug for MemoryStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryStats

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for MemoryStats

Source§

impl PartialEq for MemoryStats

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MemoryStats

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.