Struct peakmem_alloc::PeakAlloc
source · pub struct PeakAlloc<T: GlobalAlloc> { /* private fields */ }
Expand description
An allocator middleware which keeps track of peak memory consumption.
Implementations§
source§impl<T: GlobalAlloc> PeakAlloc<T>
impl<T: GlobalAlloc> PeakAlloc<T>
sourcepub const fn new(inner: T) -> Self
pub const fn new(inner: T) -> Self
Provides access to an instrumented instance of the given global allocator.
sourcepub fn reset_peak_memory(&self)
pub fn reset_peak_memory(&self)
Resets the peak memory to 0
sourcepub fn get_peak_memory(&self) -> usize
pub fn get_peak_memory(&self) -> usize
Get the peak memory consumption
Trait Implementations§
source§impl<'a, T: GlobalAlloc + 'a> GlobalAlloc for &'a PeakAlloc<T>
impl<'a, T: GlobalAlloc + 'a> GlobalAlloc for &'a PeakAlloc<T>
source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocate memory as described by the given
layout
. Read moresource§impl<T: GlobalAlloc> GlobalAlloc for PeakAlloc<T>
impl<T: GlobalAlloc> GlobalAlloc for PeakAlloc<T>
source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocate memory as described by the given
layout
. Read more