Available on crate feature
memory only.Expand description
Cgroup-aware memory limit and pressure detection.
Three signals, all container-first (what the kernel/OOM-killer act on, not
host-wide used/total):
- limit (
memory.max): the hard ceiling – crossing it is an OOM-kill. - high (
memory.high): the soft throttle – the kernel reclaims hard and throttles allocations here, BEFORE the OOM-kill. Shedding before it avoids a latency cliff. - PSI (
memory.pressuresome avg10): the earliest signal – the fraction of the last 10s in which a task stalled waiting on memory. It rises on reclaim/thrash before byte ratios cross a threshold.
Functions§
- detect_
memory_ high - Soft throttle ceiling: cgroup v2
memory.high. - detect_
memory_ limit - Detect the memory limit for this process.
- detect_
memory_ pressure - Detect THIS container’s own memory pressure as a 0.0-1.0+ usage fraction.
- detect_
memory_ stall - Memory PSI stall fraction: cgroup v2
memory.pressuresome avg10, as a 0.0-1.0 fraction (avg10is the percentage of the last 10s in which at least one task stalled waiting on memory).