peakmem-alloc 0.2.2

An allocator wrapper that allows for scoped peak memory consumption
Documentation
# peakmem_alloc

An instrumenting middleware for global allocators in Rust, useful to find the peak memory consumed by a function.

## Example

```rust
use peakmem_alloc::*;
use std::alloc::System;

#[global_allocator]
static GLOBAL: &PeakAlloc<System> = &INSTRUMENTED_SYSTEM;

#[test]
fn example_using_region() {
    GLOBAL.reset_peak_memory(); // Note that other threads may impact the peak memory computation.
    let _x: Vec<u8> = Vec::with_capacity(1_024);
    println!(
        "Peak Memory used by function : {:#?}", 
        GLOBAL.get_peak_memory()
    );
}

``` 

## Custom allocators

You can wrap your existing allocator as follows:

```rust
use jemallocator::Jemalloc;
use peakmem_alloc::*;

#[global_allocator]
static GLOBAL: PeakAlloc<Jemalloc> = PeakAlloc::new(Jemalloc);

```