[−][src]Struct slabmalloc::SCAllocator
A slab allocator allocates elements of a fixed size.
It has a list of ObjectPage stored inside slabs
from which
it allocates memory.
Methods
impl<'a> SCAllocator<'a>
[src]
pub const fn new(
size: usize,
pager: &'a Mutex<dyn PageProvider<'a>>
) -> SCAllocator<'a>
[src]
size: usize,
pager: &'a Mutex<dyn PageProvider<'a>>
) -> SCAllocator<'a>
Create a new SCAllocator.
pub fn size(&self) -> usize
[src]
Return object size of this allocator.
pub fn insert_slab<'b>(&'b mut self, new_head: &'a mut ObjectPage<'a>)
[src]
Add a new ObjectPage.
pub fn allocate<'b>(&'b mut self, layout: Layout) -> *mut u8
[src]
Allocates a block of memory with respect to alignment
.
In case of failure will try to grow the slab allocator by requesting additional pages and re-try the allocation once more before we give up.
pub fn deallocate<'b>(&'b mut self, ptr: *mut u8, layout: Layout)
[src]
Deallocates a previously allocated block.
Bug
This never releases memory in case the ObjectPage are provided by the zone.
Auto Trait Implementations
impl<'a> Unpin for SCAllocator<'a>
impl<'a> Send for SCAllocator<'a>
impl<'a> Sync for SCAllocator<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,