pub fn detect_memory_pressure() -> Option<f64>Available on crate feature
memory only.Expand description
Detect THIS container’s own memory pressure as a 0.0-1.0+ usage fraction.
Returns the WORST of current/max and current/high (v2), so the signal
rises as the container approaches EITHER the hard OOM ceiling or the soft
throttle, whichever is nearer. Falls back to v1 usage/limit. None when
no cgroup memory limit is in force (bare metal, or memory.max == max), in
which case callers fall back to a process/host signal.
This is the signal a container scheduler (K8s/cgroup OOM killer) actually
acts on – unlike host-wide used/total memory, which on a large shared
host is unrelated to this container’s limit.