pub struct BitmapAlloc { /* private fields */ }
Expand description
Free space bitmap-based external memory allocator.
See the module-level documentation for more.
Implementations§
Source§impl 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§
Source§impl Clone for BitmapAlloc
impl Clone for BitmapAlloc
Source§fn clone(&self) -> BitmapAlloc
fn clone(&self) -> BitmapAlloc
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more