Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

From there to paragc

paragc is assembled from ideas in the previous chapters, plus one that only Rust allows. This page maps each part of paragc to where it comes from; the rest of the book explains each part in detail.

What paragc takes

IdeaOriginIn paragc
Tracing from rootsMcCarthy, 1960every collection marks from Roots, entries and remembered slots
Tri-color marking, SATB barrierDijkstra et al. 1978; Yuasa 1990concurrent marking with a deletion barrier on Slot writes and black allocation (Concurrent)
Bump allocation in thread-local bufferscopying collectors; JVM TLABsTlab, one per thread in mutate (Allocation)
Mark-region heap: blocks and linesImmix, 200832 KiB blocks, 256 B lines, overflow allocation (Layout)
Opportunistic evacuationImmixsparse blocks copied while marking (Evacuation)
Generations, remembered setsLieberman & Hewitt; Ungarsticky-mark young collections, slot logging (Young collections)
Parallel marking with work stealingEndo, Flood et al.; JVM Parallel and G1crossbeam deques per worker (Marking)
Reference counting for old objects, background releaseCollins 1960; LXR 20226-bit counts settled at young collections, decrements on the pool (Reference counting)
Weak referencesLisp weak pointers; Java WeakReferenceWeak, cleared in every pause (Weak references)
A collector as a library for a host languageBoehm GC, cppgca Rust crate; j8 builds its JS heap on it

What paragc adds

The borrow checker as the stop-the-world. JVMs need safepoints and stack maps. cppgc needs conservative stack scanning. paragc needs neither:

  • a Gc<'gc, T> cannot leave the mutate call it came from, so outside mutate no unregistered pointer exists;
  • a stop-the-world collection takes &mut Heap, so the compiler proves no mutate is running.

That is why paragc can move objects (evacuation, young copying) without read barriers and without conservative pinning, as a plain library.

No locks anywhere. Many mutators allocate at once from one heap. Blocks, roots, weak references and work queues are lock-free structures, and the thread pool is woken with one atomic word.

Heaps in shared memory, across processes. No collector in the previous chapters lets several processes use one heap at once. paragc’s cross-heaps do:

  • objects without code pointers, collected by pointer maps;
  • offsets that mean the same thing in every process;
  • crash recovery when a process dies mid-collection;
  • weak references and signatures that never make one process wait for another;
  • promotion of a private heap’s survivors into a cross-heap.

The rest of the book starts from the user’s side (Quick start), then goes through the private heap, references between heaps, and the cross-heap.