Crates.io | allocative |
lib.rs | allocative |
version | 0.3.4 |
created_at | 2022-11-04 03:49:00.512986+00 |
updated_at | 2024-12-13 15:03:09.288534+00 |
description | Inspect rust object tree and output it as flamegraph |
homepage | |
repository | https://github.com/facebookexperimental/allocative |
max_upload_size | |
id | 704807 |
size | 138,146 |
This crate implements a lightweight memory profiler which allows object traversal and memory size introspection.
Allocative
trait (typically implemented with proc-macro) is introspectable:
Allocative
values can be traversed and their size and sizes of referenced
objects can be collected.
This crate provides a few utilities to work with such objects, the main of such utilities is flame graph builder which produces flame graph (see the crate documentation) like this:
Allocative is not a substitute for call stack malloc profiler, it provides a different view of memory usage.
Here are some differences between allocative and call-stack malloc profiler:
Allocative
trait for each type which
needs to be measured, and some setup in the program to enable it is neededWhen allocative is used, binary size is slightly increased due to
implementations of [Allocative
] trait, but it has no runtime/memory overhead
when it is enabled but not used.
Note there are several copies of this project on GitHub due to how Meta monorepo is synchronized to GitHub. The main copy is facebookexperimental/allocative.
Allocative is both MIT and Apache License, Version 2.0 licensed, as found in the LICENSE-MIT and LICENSE-APACHE files.