pub struct AccountingAllocator<InnerAllocator> { /* private fields */ }Expand description
Install this as the global allocator to get memory usage tracking.
Use set_tracking_callstacks or turn_on_tracking_if_env_var to turn on memory tracking.
Collect the stats with tracking_stats.
Usage:
use re_memory::AccountingAllocator;
#[global_allocator]
static GLOBAL: AccountingAllocator<std::alloc::System> = AccountingAllocator::new(std::alloc::System);Implementations§
source§impl<InnerAllocator> AccountingAllocator<InnerAllocator>
impl<InnerAllocator> AccountingAllocator<InnerAllocator>
Trait Implementations§
source§impl<InnerAllocator: Default> Default for AccountingAllocator<InnerAllocator>
impl<InnerAllocator: Default> Default for AccountingAllocator<InnerAllocator>
source§fn default() -> AccountingAllocator<InnerAllocator>
fn default() -> AccountingAllocator<InnerAllocator>
Returns the “default value” for a type. Read more
source§impl<InnerAllocator: GlobalAlloc> GlobalAlloc for AccountingAllocator<InnerAllocator>
impl<InnerAllocator: GlobalAlloc> GlobalAlloc for AccountingAllocator<InnerAllocator>
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§unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
Behaves like
alloc, but also ensures that the contents
are set to zero before being returned. Read more