#allocation #memory #observability

tracking-allocator

global allocator that provides hooks for tracking allocation events

6 releases (3 breaking)

0.4.0 Jul 1, 2022
0.3.0 May 12, 2022
0.2.0 May 11, 2022
0.1.2 Oct 5, 2021

#317 in Memory management

Download history 278/week @ 2024-07-21 217/week @ 2024-07-28 273/week @ 2024-08-04 114/week @ 2024-08-11 198/week @ 2024-08-18 101/week @ 2024-08-25 183/week @ 2024-09-01 101/week @ 2024-09-08 129/week @ 2024-09-15 127/week @ 2024-09-22 124/week @ 2024-09-29 25/week @ 2024-10-06 64/week @ 2024-10-13 210/week @ 2024-10-20 74/week @ 2024-10-27 216/week @ 2024-11-03

565 downloads per month

MPL-2.0 license

43KB
536 lines

tracking-allocator

A GlobalAlloc-compatible allocator implementation that provides the ability to track allocation events.

examples

As allocators are specialized bits of code, we've included an example in the examples/ folder to show how to use tracking_allocator, rather than putting abbreviated snippets in the README. It is extensively documented, and explains the finer points of using this crate, and what can be acheived with it.

The actual Rust-level documentation is present, and should hopefully be clear and concise, but the example is meant to be how you learn to use the crate, with the Rust-level documentation as a rote "what's that type signature again?" style of reference.

When running the example, you should end up seeing output similar to this:

allocation -> addr=0x55e882b744f0 size=80 group_id=Some(0) tags=None
deallocation -> addr=0x55e882b74490
allocation -> addr=0x55e882b74550 size=12 group_id=Some(1) tags=None
allocation -> addr=0x55e882b74570 size=96 group_id=Some(1) tags=None
deallocation -> addr=0x55e882b74550
deallocation -> addr=0x55e882b74570

Dependencies

~0–275KB