GenerationalAllocator

Struct GenerationalAllocator 

Source
pub struct GenerationalAllocator { /* private fields */ }
Expand description

Main generational allocator

Implementations§

Source§

impl GenerationalAllocator

Source

pub fn new(config: &GcConfig) -> Self

Source

pub fn allocate( &mut self, value: Value, stats: &GcStats, ) -> Result<GcPtr<Value>>

Allocate a Value object

Source

pub fn young_take_allocations(&mut self) -> Vec<*const u8>

Drain allocated object pointers from the young generation

Source

pub fn young_reset(&mut self)

Reset the young generation after a collection cycle

Source

pub fn young_mark_survivor(&mut self, ptr: *const u8)

Mark a pointer in young generation as survivor (for potential policies)

Source

pub fn young_allocations_count(&self) -> usize

Get count of currently tracked young-generation allocations since last sweep

Source

pub fn promote( &mut self, ptr: *const Value, _from_gen: usize, ) -> Result<GcPtr<Value>>

Promote an object to the next generation

Source

pub fn young_has_survivors(&self) -> bool

Check if young generation currently tracks any survivors

Source

pub fn find_generation(&self, ptr: *const u8) -> Option<usize>

Find which generation contains a pointer

Source

pub fn young_generation_usage(&self) -> f64

Get young generation usage as a percentage

Source

pub fn total_usage(&self) -> f64

Get total heap usage as a percentage

Source

pub fn reconfigure(&mut self, config: &GcConfig) -> Result<()>

Reconfigure the allocator

Source

pub fn note_survivor_and_maybe_promote(&mut self, ptr: *const u8) -> bool

Increment survival count and promote if threshold reached Increment survival count; return true if promotion occurred this cycle

Source

pub fn logical_generation(&self, ptr: *const u8) -> Option<usize>

Query logical generation of a pointer: 0 for young, >=1 for promoted/old

Source

pub fn clear_promotion_state(&mut self)

Clear promotion bookkeeping (e.g., after major GC)

Source

pub fn stats(&self) -> AllocatorStats

Get allocator statistics

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.