pub struct BumpAllocator {
pub start: usize,
pub len: usize,
}Expand description
The bump allocator used as the default rust heap when running programs.
Fields§
§start: usizelen: usizeImplementations§
Source§impl BumpAllocator
impl BumpAllocator
Sourcepub unsafe fn new(arena: &mut [u8]) -> Self
pub unsafe fn new(arena: &mut [u8]) -> Self
Creates the allocator tied to a provided slice. This will not initialize the provided memory, except for the first bytes where the pointer is stored.
§Safety
As long as BumpAllocator or any of its allocations are alive, writing into or deallocating the arena will cause UB.
Integer arithmetic in this global allocator implementation is safe when
operating on the prescribed HEAP_START_ADDRESS and HEAP_LENGTH. Any
other use may overflow and is thus unsupported and at one’s own risk.
Trait Implementations§
Source§impl GlobalAlloc for BumpAllocator
Integer arithmetic in this global allocator implementation is safe when
operating on the prescribed HEAP_START_ADDRESS and HEAP_LENGTH. Any
other use may overflow and is thus unsupported and at one’s own risk.
impl GlobalAlloc for BumpAllocator
Integer arithmetic in this global allocator implementation is safe when
operating on the prescribed HEAP_START_ADDRESS and HEAP_LENGTH. Any
other use may overflow and is thus unsupported and at one’s own risk.
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
layout. Read more