#malloc #memory #glibc #debugging

malloc-info

A safe wrapper around glibc's malloc_info

3 releases

0.1.2 Jan 16, 2025
0.1.1 Jan 15, 2025
0.1.0 Jan 15, 2025

#175 in Memory management

Download history 603/week @ 2025-01-15 343/week @ 2025-01-22

946 downloads per month

MIT/Apache

15KB
313 lines

malloc-info

This is a simple library to wrap glibc's malloc_info function in a safe, Rust interface.

License

malloc-info is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2025 Zetier


lib.rs:

This crate provides safe access to glibc's malloc_info function. See the malloc_info(3) page for details on that function.

Example

let info = malloc_info().expect("malloc_info");
println!("{:#?}", info);

Caveats

malloc_info is a glibc-specific function and is not available on all platforms. This crate will not work on platforms where malloc_info is not available.

malloc_info will only report heap statistics for the glibc heap. If your program uses a different heap implementation, for example by #[global_allocator] or by using a different libc, malloc_info will not report statistics for that heap.

Dependencies

~1.5–8.5MB
~74K SLoC