| Crates.io | tralloc |
| lib.rs | tralloc |
| version | 0.1.1 |
| created_at | 2019-07-25 13:19:46.461895+00 |
| updated_at | 2019-07-27 21:51:48.937671+00 |
| description | trace allocations and deallocations |
| homepage | |
| repository | https://github.com/19h/tralloc |
| max_upload_size | |
| id | 151556 |
| size | 10,671 |
This project allows you to log all the allocations to stderr, stdout or a file.
To use it, register the global allocator and activate it:
#![feature(global_allocator)]
extern crate tralloc;
#[global_allocator]
static GLOBAL: tralloc::Allocator = tralloc::Allocator{};
fn main() {
tralloc::Allocator::write_to_stderr();
tralloc::Allocator::activate();
let s = String::from("Hello world!");
let mut v = Vec::new();
v.push(1);
The following will be printed:
00029801ACDA259B A 00007FB780500000 000000000000000C
00029801ACDB7EFB A 00007FB780500010 0000000000000010
00029801ACDBAAC1 D 00007FB780500010 0000000000000010
00029801ACDBCD09 D 00007FB780500000 000000000000000C
Columns:
A for allocation, D for deallocationYou can use the activate and deactivate methods to start
and stop collection at any time.
This repository is based on tracing_allocator. It was forked because of breaking changes in Rust internals and lack of communication from the original author.