Skip to main content

Module memory

Module memory 

Source
Expand description

Resident Set Size (RSS) sampling for memory diagnostics.

Used by the allocator benchmark (vtcode bench-allocator) to measure whether the global allocator returns memory to the OS after bursty/sparse workloads. Unlike performance_profiler::get_memory_usage_mb (Linux /proc only, fake fallback on macOS), this returns a real value on every supported platform.

Functionsยง

resident_set_size_mb
Returns the current process Resident Set Size in megabytes, or None if it cannot be determined on the current platform.
sample_peak_rss_mb
Sample RSS repeatedly, returning the maximum observed value in MB. Useful for capturing peak memory during a burst of activity.
sample_rss_mb
Sample RSS once and return the value in MB (0.0 if unavailable).