Type Alias Allocator

Source
pub type Allocator = ProfiledAllocator<Jemalloc>;

Aliased Type§

pub struct Allocator(/* private fields */);

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 2 bytes

Implementations

§

impl<T> ProfiledAllocator<T>

pub const fn new( inner_allocator: T, callstack_depth: u16, ) -> ProfiledAllocator<T>

Construct a new ProfiledAllocator.

Specifying a non-zero callstack_depth will enable collection of callstack for this message. The number provided will limit the number of call frames collected. Note that enabling callstack collection introduces a non-trivial amount of overhead to each allocation and deallocation.

Trait Implementations

§

impl<T> GlobalAlloc for ProfiledAllocator<T>
where T: GlobalAlloc,

§

unsafe fn alloc(&self, layout: Layout) -> *mut u8

Allocates memory as described by the given layout. Read more
§

unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout)

Deallocates the block of memory at the given ptr pointer with the given layout. Read more
§

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
§

unsafe fn realloc( &self, ptr: *mut u8, layout: Layout, new_size: usize, ) -> *mut u8

Shrinks or grows a block of memory to the given new_size in bytes. The block is described by the given ptr pointer and layout. Read more