This commit is contained in:
Martin Grigorov 2025-07-02 14:51:10 +03:00 committed by GitHub
commit a5894df571
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -865,7 +865,10 @@ fn total_memory_bytes() -> Option<u64> {
let mem_kind = RefreshKind::nothing().with_memory(MemoryRefreshKind::nothing().with_ram());
let mut system = System::new_with_specifics(mem_kind);
system.refresh_memory();
Some(system.total_memory())
system
.cgroup_limits()
.map(|limits| limits.total_memory)
.or_else(|| Some(system.total_memory()))
} else {
None
}