Expand description
Tri-color mark phase for the GC.
Colors:
- White: Unmarked, potentially reclaimable after marking completes.
- Gray: Reachable, but children not yet scanned.
- Black: Reachable, all children scanned.
Algorithm:
- All objects start white.
- Root objects are colored gray and pushed to the worklist.
- Process gray objects: for each, trace children (color white->gray), color self black.
- After worklist is empty, all white objects are garbage.
§Incremental marking
Instead of processing the entire gray worklist in one STW pause, the marker
exposes mark_step(budget) which processes a bounded number of objects per
mutator safepoint. An SATB write barrier (see barrier.rs) records
references overwritten by the mutator during marking. Mark termination is a
short STW pause that drains the SATB buffers and re-processes any new grays
until convergence.
Structs§
- Marker
- The marker manages the gray worklist and tri-color state.
Enums§
- Mark
Phase - Marker phase state.