Memthol is a visualizer for memory profiling data generated from OCaml programs.
- multi-client: open several tabs in your browser for the same profiling session to visualize the data separately
- self-contained: the BUI packs all its static assets, once you have the binary you do not need anything else (except a browser)
- data-splitting: plot several families of data separately in the same chart by separating them based on size, allocation lifetime, source locations in the allocation callstack, etc.
- multiple metrics to plot different kinds of data: allocation lifetime, size, time of creation, etc.
- flamegraphs
Memthol is mostly tested on the Chrome web browser. You might experience problems with other browser, in which case we recommend you open an issue.
Memthol's current official input format is memory dumps produced by Memtrace (on github). A memtrace dump for a program execution is a single Common Trace Format (CTF) file.
Note that this repository contains a minimal Memtrace example in rsc/memtrace_example
.
Since memthol's UI is browser-based, it has a client written in Rust that compiles to web assembly (wasm). To do this, you need to have the rust toolchain.
-
add the wasm target for rustup:
rustup target add wasm32-unknown-unknown
-
make sure everything is up to date with
rustup update
-
make sure you have wasm-pack installed so that Rust can compile the client
installation instructions here, although
cargo install wasm-pack
should work -
install
cargo-make
withcargo install cargo-make
Memthol UI's dependencies rely on some OS-level packages. Please make sure they are installed and in your path:
- build essentials (including
cmake
) - openssl/libssl
- freetype
- expat
NB: memthol is quite slow in
debug
mode. If you have a lot of data to process, definitely build in release instead.
To build memthol in debug
mode, run
cargo make build
The memthol binary will be in target/debug/memthol
To build memthol in release
mode, run
cargo make release
The memthol binary will be in ./memthol_ui
, also available as target/release/memthol
.
Run memthol-ui on the test files located on this repository, in rsc/ctf/mini_ae.ctf
to make sure
it works. Assuming your binary is called memthol
and is in you path, and you are at the root of
this repository:
memthol rsc/dumps/ctf/mini_ae.ctf
There is a bigger set of data you can use for testing, although we recommend you build in release
mode for this one:
memthol rsc/dumps/ctf/flambda.ctf
Most icons used in memthol come from the bootstrap library.