Skip to main content

Module gc

Module gc 

Source
Expand description

GcRef<T> — the GC-managed reference handle.

Phase A/B/C: thin newtype around Rc<T>. Phase D-1e (current): newtype around lua_gc::Gc<T> — Copy under the hood, tracks allocation in the active Heap (via lua_gc::with_current_heap(...)).

Surface kept stable across the swap: new, ptr_eq, identity, strong_count, weak_count, downgrade. Existing code touching gc.0 continues to work — .0 is now Gc<T> instead of Rc<T>.

§Weak refs

Heap-tracked GcWeak<T> handles remember the heap active when they were created plus the target’s heap allocation token. They upgrade only while that identity/token pair remains live. Handles to legacy uncollected boxes still upgrade forever, matching their process-lifetime allocation model.

Structs§

GcRef
A GC-managed pointer to a Lua collectable object. Newtype over lua_gc::Gc<T> so callers preserve gc.0-shape access while the backend swaps under them.
GcWeak
A weak handle to a GcRef<T>.