Trait mun_memory::gc::GcRuntime[][src]

pub trait GcRuntime<T: TypeMemory + TypeTrace>: Send + Sync {
    fn alloc(&self, ty: T) -> GcPtr;
fn ptr_type(&self, obj: GcPtr) -> T;
fn root(&self, obj: GcPtr);
fn unroot(&self, obj: GcPtr);
fn stats(&self) -> Stats; }

An object that can be used to allocate and collect memory.

Required methods

fn alloc(&self, ty: T) -> GcPtr[src]

Allocates an object of the given type returning a GcPtr

fn ptr_type(&self, obj: GcPtr) -> T[src]

Returns the type of the specified obj.

fn root(&self, obj: GcPtr)[src]

Roots the specified obj, which keeps it and objects it references alive. Objects marked as root, must call unroot before they can be collected. An object can be rooted multiple times, but you must make sure to call unroot an equal number of times before the object can be collected.

fn unroot(&self, obj: GcPtr)[src]

Unroots the specified obj, potentially allowing it and objects it references to be collected. An object can be rooted multiple times, so you must make sure to call unroot the same number of times as root was called before the object can be collected.

fn stats(&self) -> Stats[src]

Returns stats about the current state of the runtime.

Loading content...

Implementors

impl<T, O> GcRuntime<T> for MarkSweep<T, O> where
    T: TypeMemory + TypeTrace + Clone,
    O: Observer<Event = Event>, 
[src]

Loading content...