#[cfg(feature = "mac")]
pub fn current_memory_bytes() -> Option<u64> {
memory_stats::memory_stats().map(|s| s.physical_mem as u64)
}
#[cfg(all(feature = "web", not(feature = "mac")))]
pub fn current_memory_bytes() -> Option<u64> {
let perf = web_sys::window()?.performance()?;
let memory = js_sys::Reflect::get(perf.as_ref(), &"memory".into()).unwrap();
if memory.is_undefined() || memory.is_null() {
return None;
}
let used = js_sys::Reflect::get(&memory, &"usedJSHeapSize".into()).unwrap();
used.as_f64().map(|v| v as u64)
}
#[cfg(not(any(feature = "mac", feature = "web")))]
pub const fn current_memory_bytes() -> Option<u64> {
None
}