Skip to main content

resample_memory_availability

Function resample_memory_availability 

Source
pub fn resample_memory_availability() -> MemoryAvailability
Expand description

Take a fresh reading of the OS and cgroup memory observations.

This is a syscall-bearing probe, not an accessor: it refreshes sysinfo (/proc/meminfo) and re-reads the cgroup limit/usage files on every call, and the value it returns moves — available memory is a live, shared quantity owned by the whole machine, not by this process.

Call this only where a live reading is the point (an OOM guard immediately before committing an allocation). Anything that routes — picks a strategy, sizes a plan, chooses an operator — must use process_memory_availability instead, because a route derived from a moving quantity makes the fitted answer depend on what else the box was doing (SPEC-20: a fit object must only ever come from a converged optimization, and reproducibly so).