Trait BaseAllocator
Source pub trait BaseAllocator {
// Required methods
fn init(&mut self, start: usize, size: usize);
fn add_memory(&mut self, start: usize, size: usize) -> AllocResult;
}
Expand description
The base allocator trait inherited by other allocator traits.
Provides common initialization methods for all allocator types.
Initialize the allocator with a free memory region.
§Arguments
start - Starting address of the memory region
size - Size of the memory region in bytes
§Examples
let mut alloc = MyAllocator;
alloc.init(0x8000_0000, 16 * 1024 * 1024);
Add a free memory region to the allocator.
§Arguments
start - Starting address of the memory region
size - Size of the memory region in bytes
§Returns
Returns Ok(()) on success, or an error if the region overlaps
with existing memory.