[][src]Struct gluon_vm::gc::Gc

pub struct Gc { /* fields omitted */ }

A mark and sweep garbage collector.

Methods

impl Gc[src]

pub fn new(generation: Generation, memory_limit: usize) -> Gc[src]

Constructs a new garbage collector

pub fn allocated_memory(&self) -> usize[src]

pub fn set_memory_limit(&mut self, memory_limit: usize)[src]

pub fn generation(&self) -> Generation[src]

pub fn new_child_gc(&self) -> Gc[src]

pub unsafe fn alloc_and_collect<R, D>(
    &mut self,
    roots: R,
    def: D
) -> Result<OwnedGcRef<D::Value>> where
    R: Trace + CollectScope,
    D: DataDef + Trace,
    D::Value: Sized + Any
[src]

Allocates a new object. If the garbage collector has hit the collection limit a collection will occur.

Unsafe since roots must be able to trace all accesible GcPtr values.

pub fn alloc<D>(&mut self, def: D) -> Result<GcRef<D::Value>> where
    D: DataDef,
    D::Value: Sized + Any
[src]

Allocates a new object.

pub fn alloc_owned<D>(&mut self, def: D) -> Result<OwnedGcRef<D::Value>> where
    D: DataDef,
    D::Value: Sized + Any
[src]

pub fn alloc_ignore_limit<D>(&mut self, def: D) -> GcRef<D::Value> where
    D: DataDef,
    D::Value: Sized + Any
[src]

pub unsafe fn check_collect<R>(&mut self, roots: R) -> bool where
    R: Trace + CollectScope
[src]

pub unsafe fn collect<R>(&mut self, roots: R) where
    R: Trace + CollectScope
[src]

Does a mark and sweep collection by walking from roots. This function is unsafe since roots need to cover all reachable object.

pub fn mark<T: ?Sized>(&mut self, value: &GcPtr<T>) -> bool[src]

Marks the GcPtr Returns true if the pointer was already marked

pub unsafe fn sweep(&mut self)[src]

Clears out any unmarked pointers and resets marked pointers.

Unsafe as it is up to the caller to make sure that all reachable pointers have been marked

pub unsafe fn clear(&mut self)[src]

Trait Implementations

impl Debug for Gc[src]

impl<'de, 'gc> DeserializeState<'de, DeSeed<'gc>> for Gc[src]

impl Drop for Gc[src]

impl SerializeState<SeSeed> for Gc[src]

Auto Trait Implementations

impl !RefUnwindSafe for Gc

impl Send for Gc

impl !Sync for Gc

impl Unpin for Gc

impl !UnwindSafe for Gc

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'_, T> Captures<'_> for T[src]

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices[src]

type Remainder = Choices

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastArc for T where
    T: Downcast + Send + Sync
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<D, T> FromPtr<D> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U, I> LiftInto<U, I> for T where
    U: LiftFrom<T, I>, 
[src]

impl<Source> Sculptor<HNil, HNil> for Source[src]

type Remainder = Source

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.