Skip to main content

total

Function total 

Source
pub fn total() -> Result<Bytes>
Expand description

What this process may use: the host’s memory, or the container’s (or job object’s) limit when that is smaller. A live reading: the limit can change while a process runs (Kubernetes in-place resize, VM ballooning).

use sys_lib as sys;

// Size a cache to a quarter of what this process may use.
let cache_bytes = sys::mem::total()?.raw() / 4;

§Errors

NotFound or PermissionDenied when a sandbox hides the OS’s memory counters; Malformed when they do not parse.