pub struct BumpAllocator { /* private fields */ }Expand description
Bump allocator managing Regions and handing out TLABs.
Implementations§
Source§impl BumpAllocator
impl BumpAllocator
Sourcepub fn alloc(&self, layout: Layout) -> *mut u8
pub fn alloc(&self, layout: Layout) -> *mut u8
Allocate memory for an object with the given layout.
Returns a pointer to the object data (after the GcHeader). The GcHeader is written automatically.
Sourcepub fn flush_tlab_for_sweep(&self)
pub fn flush_tlab_for_sweep(&self)
Public TLAB flush for use by the incremental sweep path in GcHeap.
Sourcepub fn sweep(&self, _marker: &Marker) -> usize
pub fn sweep(&self, _marker: &Marker) -> usize
Sweep all regions: walk objects, reclaim white objects. Returns total bytes collected.
Sourcepub fn total_region_bytes(&self) -> usize
pub fn total_region_bytes(&self) -> usize
Total bytes across all regions.
Sourcepub fn region_count(&self) -> usize
pub fn region_count(&self) -> usize
Number of regions.
Sourcepub fn regions(&self) -> &Vec<Region>
pub fn regions(&self) -> &Vec<Region>
Get a reference to all regions (for the marker to iterate).
Sourcepub fn regions_mut(&self) -> &mut Vec<Region>
pub fn regions_mut(&self) -> &mut Vec<Region>
Get a mutable reference to all regions.
Trait Implementations§
Source§impl Default for BumpAllocator
impl Default for BumpAllocator
impl Send for BumpAllocator
impl Sync for BumpAllocator
Auto Trait Implementations§
impl !Freeze for BumpAllocator
impl !RefUnwindSafe for BumpAllocator
impl Unpin for BumpAllocator
impl UnsafeUnpin for BumpAllocator
impl UnwindSafe for BumpAllocator
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