rw_resource_util::memory

Function system_memory_available_bytes

source
pub fn system_memory_available_bytes() -> usize
Expand description

Returns the total memory available by the system in bytes.

If running in container, this function will read the cgroup interface files for the memory available/limit, if interface files are not found, will return the system memory volume by default. The cgroup mount point is assumed to be at /sys/fs/cgroup by default.

§Examples

Basic usage:

let mem_available = memory::system_memory_available_bytes();