pub struct EspHeap { /* private fields */ }
Implementations
sourceimpl EspHeap
impl EspHeap
sourcepub const fn empty() -> EspHeap
pub const fn empty() -> EspHeap
Crate a new UNINITIALIZED heap allocator
You must initialize this heap using the
init
method before using the
allocator.
sourcepub unsafe fn init(&self, heap_bottom: *mut u8, size: usize)
pub unsafe fn init(&self, heap_bottom: *mut u8, size: usize)
Initializes the heap
This function must be called BEFORE you run any code that makes use of the allocator.
heap_bottom
is a pointer to the location of the bottom of the heap.
size
is the size of the heap in bytes.
Note that:
-
The heap grows “upwards”, towards larger addresses. Thus
end_addr
must be larger thanstart_addr
-
The size of the heap is
(end_addr as usize) - (start_addr as usize)
. The allocator won’t use the byte atend_addr
.
Safety
Obey these or Bad Stuff will happen.
- This function must be called exactly ONCE.
size > 0
Trait Implementations
sourceimpl GlobalAlloc for EspHeap
impl GlobalAlloc for EspHeap
sourceunsafe 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
sourceunsafe fn dealloc(&self, ptr: *mut u8, layout: Layout)
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout)
Deallocate the block of memory at the given ptr
pointer with the given layout
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for EspHeap
impl Send for EspHeap
impl Sync for EspHeap
impl Unpin for EspHeap
impl UnwindSafe for EspHeap
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more