https://github.com/tobz/tracking-allocator
global allocator for Rust that provides hooks for tracking allocations
https://github.com/tobz/tracking-allocator
allocator rust telemetry
Last synced: 7 months ago
JSON representation
global allocator for Rust that provides hooks for tracking allocations
- Host: GitHub
- URL: https://github.com/tobz/tracking-allocator
- Owner: tobz
- License: mpl-2.0
- Created: 2021-10-03T23:21:03.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-17T16:27:32.000Z (almost 3 years ago)
- Last Synced: 2024-10-13T14:11:43.060Z (over 1 year ago)
- Topics: allocator, rust, telemetry
- Language: Rust
- Homepage:
- Size: 125 KB
- Stars: 47
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# tracking-allocator
A [`GlobalAlloc`](https://doc.rust-lang.org/stable/std/alloc/trait.GlobalAlloc.html)-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
```