mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
Despite using `jemalloc` by default on macos as the Rust global allocator, the default system allocator will still be used by some C/C++ libraries. Using `malloc_zone_statistics` on macos allows us to get information about the system allocator heap usage. Since the macos statistic also provides information about reserved, but currently unused memory, we also expose that and attempt to calculate the same metric on Linux, which should be arena (Non-mmapped space allocated (bytes)) + hblkhd (Space allocated in mmapped regions (bytes)) See https://man7.org/linux/man-pages/man3/mallinfo.3.html Loading `servo.org` in a debug build on macOS and then navigating to about:memory, I see 31MB system-heap-allocated and 92 MB system-heap-reserved. Testing: Manually tested on macOS. Not tested on Linux. --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>