Skip to main content

total_ram_bytes

Function total_ram_bytes 

Source
pub fn total_ram_bytes() -> Option<u64>
Expand description

Returns the total physical RAM of the machine in bytes, best-effort.

  • Linux: sysconf(_SC_PHYS_PAGES) × sysconf(_SC_PAGE_SIZE).
  • macOS: sysctlbyname("hw.memsize", …).
  • Other targets: None.

Returns None on any error; never panics. The adaptive controller uses this as the denominator of its memory-budget guardrail.