pub fn memory_available() -> Result<Option<u64>, ReadParseError>Expand description
Returns the available memory in bytes.
Formula: memory_max() - memory_net_used()
§Errors
Returns an error if the memory max file MEMORY_MAX or the memory statistics file MEMORY_STAT could not be read or parsed.
§Panics
This function will panic if any arithmetic operation (subtraction) overflows.
§Example
match memory_available() {
Ok(Some(available)) => println!("Available memory: {} bytes", available),
Ok(None) => println!("No memory limit set"),
Err(e) => println!("Failed to read memory information: {}", e),
}