check_available_memory

Function check_available_memory 

Source
pub fn check_available_memory() -> Option<MemoryInfo>
Expand description

Check available memory on the current system

Returns memory information if available, None if memory info cannot be determined.

§Platform Support

  • Native (Linux): Reads /proc/meminfo for available memory
  • Native (macOS): Uses sysctl for memory statistics
  • Native (Windows): Uses GlobalMemoryStatusEx
  • WASM/Browser: Uses Performance.memory API if available (Chrome/Edge)

§Returns

  • Some(MemoryInfo) with available and optionally total/used memory
  • None if memory information is unavailable

§Example

use absurder_sql::utils::check_available_memory;

if let Some(mem_info) = check_available_memory() {
    println!("Available memory: {} bytes", mem_info.available_bytes);
}