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

pub struct Gc {
    // some fields omitted
}

A mark and sweep garbage collector.

Methods

impl Gc
[src]

fn new(generation: usize) -> Gc

Constructs a new garbage collector

fn generation(&self) -> usize

fn new_child_gc(&self) -> Gc

unsafe fn alloc_and_collect<R, D>(&mut self, roots: R, def: D) -> GcPtr<D::Value> where R: Traverseable, D: DataDef + Traverseable, D::Value: Sized + Any

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

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

fn alloc<D>(&mut self, def: D) -> GcPtr<D::Value> where D: DataDef, D::Value: Sized + Any

Allocates a new object.

unsafe fn check_collect<R>(&mut self, roots: R) -> bool where R: Traverseable

unsafe fn collect<R>(&mut self, roots: R) where R: Traverseable

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

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

Marks the GcPtr Returns true if the pointer was already marked

Trait Implementations

impl Debug for Gc
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.