Skip to main content

events

Function events 

Source
pub fn events() -> Result<Option<MemoryEvents>>
Expand description

Whether this container (or machine) has been running out of memory. A watchdog compares two readings and sheds load before the next kill.

Linux: cgroup v2 memory.events, cgroup v1 memory.oom_control, and outside a cgroup /proc/vmstat (max and high are then 0). macOS and Windows keep no such counters: None.

use sys_lib as sys;

if let Some(e) = sys::mem::events()? {
    println!("{} out-of-memory kills ({:?})", e.oom_kills, e.scope);
}

ยงErrors

Malformed when a counter file does not parse.