pub struct GcArena { /* private fields */ }Expand description
Bump-pointer arena + free-list hybrid allocator
Implementations§
Source§impl GcArena
impl GcArena
Sourcepub fn new(capacity: usize) -> Option<Self>
pub fn new(capacity: usize) -> Option<Self>
Create a new arena, allocating capacity bytes from the system allocator.
Sourcepub fn alloc(&self, layout: Layout) -> Option<NonNull<u8>>
pub fn alloc(&self, layout: Layout) -> Option<NonNull<u8>>
Main allocation path: bump → free-list → None.
Bump is checked first because in practice most dead nodes are
reclaimed via frontier rewind (see [collect_hole]), so the free-list
is usually empty. Swapping the order avoids an unnecessary linked-list
traversal on the common (bump) path.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GcArena
impl !RefUnwindSafe for GcArena
impl !Send for GcArena
impl !Sync for GcArena
impl Unpin for GcArena
impl UnsafeUnpin for GcArena
impl UnwindSafe for GcArena
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