[][src]Crate zerogc

Zero overhead tracing garbage collection for rust, by abusing the borrow checker.

Planned Features

  1. Easy to use, since Gc<T> is Copy and coerces to a reference.
  2. Absolutely zero overhead when modifying pointers, since Gc<T> is Copy.
  3. Support for important libraries builtin to the collector
  4. Unsafe code has complete freedom to manipulate garbage collected pointers, and it doesn't need to understand the distinction
  5. Uses rust's lifetime system to ensure all roots are known at explicit safepoints, without any runtime overhead.
  6. Collection can only happen with an explicit safepoint call and has no overhead between these calls,
  7. Optional graceful handling of allocation failures.

Re-exports

pub use self::cell::GcCell;

Modules

cell

Macros

__recurse_context

Create a new sub-context for the duration of the closure

safepoint

Indicate it's safe to begin a garbage collection, while keeping the specified root alive.

safepoint_recurse

Invoke the closure with a temporary GcContext, then perform a safepoint afterwards.

unsafe_gc_brand

Unsafely assume that the generic implementation of GcBrand is valid, if and only if it's valid for the generic lifetime and type parameters.

unsafe_immutable_trace_iterable

Unsafely implement ImmutableTrace for the specified iterable type, by iterating over the type to trace all objects.

unsafe_trace_deref

Unsafely implement GarbageCollected for the specified type, by converting the specified wrapper type in order to trace the underlying objects.

unsafe_trace_lock

Unsafely implement GarbageCollected for the specified type, by acquiring a 'lock' in order to trace the underlying value.

unsafe_trace_primitive

Unsafely implement GarbageCollected for the specified type, by assuming it's a 'primitive' and never needs to be traced.

Structs

AssumeNotTraced

A wrapper type that assumes its contents don't need to be traced

Traits

GcBrand

Changes all references to garbage collected objects to match 'new_gc.

GcContext

The context of garbage collection, which can be frozen at a safepoint.

GcRef

A garbage collected pointer to a value.

GcSafe

Indicates that a type can be safely allocated by a garbage collector.

GcSimpleAlloc

A simple interface to allocating

GcSystem

A garbage collector implementation.

GcVisitor

Visits garbage collected objects

NullTrace

Marker types for types that don't need to be traced

Trace

Indicates that a type can be traced by a garbage collector.

TraceImmutable

A type that can be safely traced/relocated without having to use a mutable reference