pub fn available_memory() -> Option<u64>Expand description
Bytes this process can still allocate before something kills it: the
smaller of the kernel’s MemAvailable and the headroom under every cgroup
memory limit above the process (v2 memory.max, or v1
memory.limit_in_bytes). Inside a container MemAvailable describes the
whole VM, so the cgroup limit is the one that matters there. Reclaimable
page cache (inactive_file) does not count as used. None when neither
source is readable (not Linux).