Generation

Struct Generation 

Source
pub struct Generation {
    pub number: usize,
    /* private fields */
}
Expand description

Represents a single generation in the generational heap

Fields§

§number: usize

Generation number (0 = youngest)

Implementations§

Source§

impl Generation

Source

pub fn new(number: usize, max_size: usize, promotion_threshold: usize) -> Self

Source

pub fn current_size(&self) -> usize

Get current size

Source

pub fn max_size(&self) -> usize

Get maximum size

Source

pub fn utilization(&self) -> f64

Get utilization as a percentage

Source

pub fn is_full(&self, threshold: f64) -> bool

Check if generation is full

Source

pub fn allocate(&self, size: usize) -> Result<()>

Allocate bytes in this generation

Source

pub fn deallocate(&self, size: usize)

Deallocate bytes from this generation

Source

pub fn record_collection(&self, objects_collected: usize, survivors: usize)

Record a collection in this generation

Source

pub fn collection_count(&self) -> usize

Get collection count

Source

pub fn survivor_count(&self) -> usize

Get survivor count from last collection

Source

pub fn should_promote(&self, object_age: usize) -> bool

Check if objects should be promoted based on survival count

Source

pub fn time_since_last_collection(&self) -> Option<Duration>

Get time since last collection

Source

pub fn collection_frequency(&self) -> f64

Get collection frequency (collections per minute)

Source

pub fn resize(&mut self, new_max_size: usize) -> Result<()>

Resize the generation

Source

pub fn reset(&self)

Reset generation state (after major collection)

Source

pub fn stats(&self) -> GenerationStats

Get generation statistics

Trait Implementations§

Source§

impl Debug for Generation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.