Tri-color marking: objects are white, gray, or black; marking drains a gray work queue, and a write barrier preserves correctness while the program mutates the heap.

White (unvisited)
0
Gray (queue)
0
Black (done)
0
Phase
init
white (unvisited)
gray (in queue)
black (done)
garbage (swept)
ROOT HEAP GRAY WORK QUEUE
What's happening
Step 1