Struct xalloc::bitmap::BitmapAlloc
source · pub struct BitmapAlloc { /* private fields */ }
Expand description
Free space bitmap-based external memory allocator.
See the module-level documentation for more.
Implementations
sourceimpl BitmapAlloc
impl BitmapAlloc
sourcepub fn alloc(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
pub fn alloc(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
Alias of alloc_next
.
sourcepub fn alloc_next(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
pub fn alloc_next(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
Allocate a region of the size size
using a Next-Fit strategy.
The time complexity is linear to the size of the heap.
Returns a handle of the allocated region and its offset if the
allocation succeeds. Returns None
otherwise.
size
must not be zero.
sourcepub fn alloc_first(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
pub fn alloc_first(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
Allocate a region of the size size
using a First-Fit strategy.
The time complexity is linear to the size of the heap.
Returns a handle of the allocated region and its offset if the
allocation succeeds. Returns None
otherwise.
size
must not be zero.
sourcepub fn dealloc_relaxed(&mut self, r: BitmapAllocRegion)
pub fn dealloc_relaxed(&mut self, r: BitmapAllocRegion)
Deallocate the specified region.
r
must originate from the same instance of BitmapAlloc
. Otherwise,
BitmapAlloc
enters an inconsistent state and possibly panics, but does
not cause an undefined behavior.
Trait Implementations
sourceimpl Clone for BitmapAlloc
impl Clone for BitmapAlloc
sourcefn clone(&self) -> BitmapAlloc
fn clone(&self) -> BitmapAlloc
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more