Struct allocator::BitmapPageAllocator
source · pub struct BitmapPageAllocator<const PAGE_SIZE: usize> { /* private fields */ }
Expand description
A page-granularity memory allocator based on the bitmap_allocator.
It internally uses a bitmap, each bit indicates whether a page has been allocated.
The PAGE_SIZE
must be a power of two.
Implementations§
Trait Implementations§
source§impl<const PAGE_SIZE: usize> BaseAllocator for BitmapPageAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> BaseAllocator for BitmapPageAllocator<PAGE_SIZE>
source§impl<const PAGE_SIZE: usize> PageAllocator for BitmapPageAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> PageAllocator for BitmapPageAllocator<PAGE_SIZE>
source§fn alloc_pages(
&mut self,
num_pages: usize,
align_pow2: usize
) -> AllocResult<usize>
fn alloc_pages( &mut self, num_pages: usize, align_pow2: usize ) -> AllocResult<usize>
Allocate contiguous memory pages with given count and alignment.
source§fn dealloc_pages(&mut self, pos: usize, num_pages: usize)
fn dealloc_pages(&mut self, pos: usize, num_pages: usize)
Deallocate contiguous memory pages with given position and count.
source§fn total_pages(&self) -> usize
fn total_pages(&self) -> usize
Returns the total number of memory pages.
source§fn used_pages(&self) -> usize
fn used_pages(&self) -> usize
Returns the number of allocated memory pages.
source§fn available_pages(&self) -> usize
fn available_pages(&self) -> usize
Returns the number of available memory pages.
Auto Trait Implementations§
impl<const PAGE_SIZE: usize> RefUnwindSafe for BitmapPageAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> Send for BitmapPageAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> Sync for BitmapPageAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> Unpin for BitmapPageAllocator<PAGE_SIZE>
impl<const PAGE_SIZE: usize> UnwindSafe for BitmapPageAllocator<PAGE_SIZE>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more