Struct buddy_system_allocator::LockedHeap
source · pub struct LockedHeap<const ORDER: usize>(_);
Expand description
A locked version of Heap
Usage
Create a locked heap and add a memory region to it:
use buddy_system_allocator::*;
let mut heap = LockedHeap::<32>::new();
unsafe {
heap.lock().init(begin, size);
// or
heap.lock().add_to_heap(begin, end);
}
Implementations§
Trait Implementations§
source§impl<const ORDER: usize> Deref for LockedHeap<ORDER>
impl<const ORDER: usize> Deref for LockedHeap<ORDER>
source§impl<const ORDER: usize> GlobalAlloc for LockedHeap<ORDER>
impl<const ORDER: usize> GlobalAlloc for LockedHeap<ORDER>
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