| Crates.io | rs_malloc_tracker |
| lib.rs | rs_malloc_tracker |
| version | 1.0.0 |
| created_at | 2025-10-27 14:23:34.817292+00 |
| updated_at | 2025-10-27 14:23:34.817292+00 |
| description | Wraps LibC allocation calls to expose Prometheus memory statistics. |
| homepage | https://gitlab.com/nathan.monfils/rs-malloc-tracker |
| repository | |
| max_upload_size | |
| id | 1903017 |
| size | 529,239 |
This tool is meant to solve a specific use-case: Troubleshooting unexplained memory usage in a C application (namely asterisk).
Ideally, you'd make every memory allocation go through a custom allocator that does proper tracking for your use-case. In my case though, I had a couple problems:

From these observations, it was clear that a lower-level instrumentation was required to properly shine light on what was going on. Hence, this tool.
LD_PRELOAD trick to:
malloc(3), free(3) and related functions to tabulate memory usagemmap(3) and munmap(3) to tabulate VSS and RSS separatelyThe end result looks like this:
![]()
This allowed me to understand what my problem was: https://github.com/facebook/jemalloc/issues/46