Rallo - Rust Allocator
This crate provides a custom allocator for Rust, useful to track where memories are allocated. You can use it to find where a function or method allocates memory, and how much memory is allocated. At the end, you can create a flamegraph like html page to visualize the memory allocation.
Usage
To use this crate, add the following to your Cargo.toml:
[]
= "*"
Then, create a new file in your tests directory, for example tests/rallo.rs, and add the following code:
use RalloAllocator;
// This is the maximum length of a frame
const MAX_FRAME_LENGTH: usize = 128;
// Maximum number of allocations to keep
const MAX_LOG_COUNT: usize = 1_024 * 10;
static ALLOCATOR: = new;
The generated HTML file will be like this:
