Skip to main content

Module memory

Module memory 

Source

Structs§

AllocatorMemorySnapshot
AllocatorObservation
One allocator reading shared by all memory surfaces in a health refresh.
AllocatorPressureRelief
What one allocator relief pass observed. There is deliberately no single “released” number: the allocator’s accounting and the process’s resident memory measure different things and disagree in practice.
JemallocMemorySnapshot
MemoryEstimate
A cold-path estimate of memory AFT can attribute without allocator hooks.
MemoryRollupSnapshot
MemorySnapshot
ProcessMemorySnapshot
ResidentReading
Resident-memory readings taken on each side of a relief pass.
RootMemoryRollup
RootMemorySnapshot
SharedProcessMemory
Memory attributed once for the whole process rather than to any root: shared semantic bases and the data layer’s block cache.
SqliteMemorySnapshot

Enums§

AllocatorSource

Constants§

ALLOCATOR_SLACK_LABEL
What retained_slack_bytes / allocator_slack_bytes measure, shown next to the number wherever it is reported so nobody reads it as resident memory.
ALLOCATOR_SLACK_RELIEF_MIN_INTERVAL
Minimum spacing between opportunistic relief passes so a workload that legitimately cycles through large allocations does not thrash the allocator.
ALLOCATOR_SLACK_RELIEF_THRESHOLD_BYTES
Address-space allocator slack above which opportunistic pressure relief is worth the zone-lock contention it briefly causes. Slack includes free pages the allocator already returned to the OS (it cannot tell which free pages are resident), so it stays above this line after a successful pass and the pass repeats at ALLOCATOR_SLACK_RELIEF_MIN_INTERVAL. That is intended: a repeat pass is cheap and returns whatever has been freed since the last one.
CENSUS_ALLOCATION_LABELS
Operations the census names by their allocation high-water mark.
MEMORY_SNAPSHOT_ROOT_DETAIL_CAP
Cap on per-root detail entries in serialized snapshots. Process totals always cover every root; only the per-root breakdown is capped so a many-root daemon process cannot balloon the status payload past downstream consumers’ size limits (the daemon metrics cache truncates around 27 KB, and JSON keys serialize alphabetically, so an oversized memory.roots map pushes later sections past the cut).
RELIEF_ACCOUNTING_SOURCE_JEMALLOC
Source label for AllocatorPressureRelief::allocator_accounting_bytes on Linux: the drop in jemalloc’s stats.resident, not the kernel’s RSS.
RELIEF_ACCOUNTING_SOURCE_MACOS
Source label for AllocatorPressureRelief::allocator_accounting_bytes on macOS: the byte count malloc_zone_pressure_relief returns, i.e. what libmalloc says it handed back. It is the allocator’s own claim, not a measurement of resident memory.

Functions§

allocator_relief_accounting_source
What last_allocator_relief_accounting_bytes measures on this platform, or None where no relief pass exists.
allocator_reuse_window_ms
How long a periodic reader may reuse an allocator observation whose walk took walk_ms: floor_ms for a cheap walk, stretched to ALLOCATOR_WALK_COST_FACTOR times the walk’s duration for an expensive one, and never past ALLOCATOR_WALK_MAX_REUSE_MS (or floor_ms, if that is larger).
allocator_slack_relief_due
Decide whether an opportunistic allocator relief pass is due.
cached_allocator_observation
Return the last process-wide allocator observation without walking allocator zones. The observation timestamp is separate from the sampler reservation so a status request never mistakes an in-progress sample for a fresh reading.
cap_root_detail
Keep the cap roots with the highest attributed bytes; report the rest as an omitted-count + omitted-bytes rollup.
cap_root_rollups
estimated_json_bytes
last_allocator_relief_accounting_bytes
Allocator-accounting figure from the latest periodic relief pass; see allocator_relief_accounting_source for what it measures on this platform.
last_allocator_relief_at_ms
last_allocator_relief_phys_footprint_drop_bytes
Observed physical-footprint drop across the latest periodic relief pass (macOS only).
last_allocator_relief_rss_drop_bytes
Observed RSS drop across the latest periodic relief pass, if one ran and both RSS readings were available.
path_bytes
process_phys_footprint_bytes
process_rss_bytes
purge_allocator
Return unused Linux allocator pages without measuring counters or RSS. Call-graph build phases use the same purge as the measured idle-relief path.
relieve_allocator_pressure
return_free_pages
rss_bytes
signed_difference
spawn_allocator_slack_relief_if_due
On Linux, opportunistically return unused allocator pages without reading allocator statistics on the module loop. The loop only reads cached atomics. When the cached observation is stale, one sampler takes an initial snapshot; if it finds enough slack, the page-return operation reuses it and takes only one additional after snapshot, limiting the pass to two statistics walks.
usize_to_u64