pub struct Arena { /* private fields */ }Expand description
An epoch-aware arena allocator.
The arena allocates memory in large chunks and uses bump-pointer allocation for fast allocation. Each arena is associated with an epoch, enabling structural sharing for MVCC.
Implementations§
Source§impl Arena
impl Arena
Sourcepub fn with_chunk_size(epoch: EpochId, chunk_size: usize) -> Self
pub fn with_chunk_size(epoch: EpochId, chunk_size: usize) -> Self
Creates a new arena with a custom chunk size.
Sourcepub fn alloc_value<T>(&self, value: T) -> &mut T
pub fn alloc_value<T>(&self, value: T) -> &mut T
Allocates a value of type T.
Sourcepub fn alloc_slice<T: Copy>(&self, values: &[T]) -> &mut [T]
pub fn alloc_slice<T: Copy>(&self, values: &[T]) -> &mut [T]
Allocates a slice of values.
Sourcepub fn total_allocated(&self) -> usize
pub fn total_allocated(&self) -> usize
Returns the total memory allocated by this arena.
Sourcepub fn total_used(&self) -> usize
pub fn total_used(&self) -> usize
Returns the total memory used (not just allocated capacity).
Sourcepub fn stats(&self) -> ArenaStats
pub fn stats(&self) -> ArenaStats
Returns statistics about this arena.
Auto Trait Implementations§
impl !Freeze for Arena
impl !RefUnwindSafe for Arena
impl Send for Arena
impl Sync for Arena
impl Unpin for Arena
impl UnwindSafe for Arena
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