pub struct GenerationalAllocator { /* private fields */ }Expand description
Main generational allocator
Implementations§
Source§impl GenerationalAllocator
impl GenerationalAllocator
pub fn new(config: &GcConfig) -> Self
Sourcepub fn allocate(
&mut self,
value: Value,
stats: &GcStats,
) -> Result<GcPtr<Value>>
pub fn allocate( &mut self, value: Value, stats: &GcStats, ) -> Result<GcPtr<Value>>
Allocate a Value object
Sourcepub fn young_take_allocations(&mut self) -> Vec<*const u8>
pub fn young_take_allocations(&mut self) -> Vec<*const u8>
Drain allocated object pointers from the young generation
Sourcepub fn young_reset(&mut self)
pub fn young_reset(&mut self)
Reset the young generation after a collection cycle
Sourcepub fn young_mark_survivor(&mut self, ptr: *const u8)
pub fn young_mark_survivor(&mut self, ptr: *const u8)
Mark a pointer in young generation as survivor (for potential policies)
Sourcepub fn young_allocations_count(&self) -> usize
pub fn young_allocations_count(&self) -> usize
Get count of currently tracked young-generation allocations since last sweep
Sourcepub fn promote(
&mut self,
ptr: *const Value,
_from_gen: usize,
) -> Result<GcPtr<Value>>
pub fn promote( &mut self, ptr: *const Value, _from_gen: usize, ) -> Result<GcPtr<Value>>
Promote an object to the next generation
Sourcepub fn young_has_survivors(&self) -> bool
pub fn young_has_survivors(&self) -> bool
Check if young generation currently tracks any survivors
Sourcepub fn find_generation(&self, ptr: *const u8) -> Option<usize>
pub fn find_generation(&self, ptr: *const u8) -> Option<usize>
Find which generation contains a pointer
Sourcepub fn young_generation_usage(&self) -> f64
pub fn young_generation_usage(&self) -> f64
Get young generation usage as a percentage
Sourcepub fn total_usage(&self) -> f64
pub fn total_usage(&self) -> f64
Get total heap usage as a percentage
Sourcepub fn reconfigure(&mut self, config: &GcConfig) -> Result<()>
pub fn reconfigure(&mut self, config: &GcConfig) -> Result<()>
Reconfigure the allocator
Sourcepub fn note_survivor_and_maybe_promote(&mut self, ptr: *const u8) -> bool
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
Sourcepub fn logical_generation(&self, ptr: *const u8) -> Option<usize>
pub fn logical_generation(&self, ptr: *const u8) -> Option<usize>
Query logical generation of a pointer: 0 for young, >=1 for promoted/old
Sourcepub fn clear_promotion_state(&mut self)
pub fn clear_promotion_state(&mut self)
Clear promotion bookkeeping (e.g., after major GC)
Sourcepub fn stats(&self) -> AllocatorStats
pub fn stats(&self) -> AllocatorStats
Get allocator statistics