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
1 · Basic marking
2 · The concurrent bug
3 · Write barrier saves it
white (unvisited)
gray (in queue)
black (done)
garbage (swept)
ROOT
HEAP
GRAY WORK QUEUE
What's happening
Prev
Next step
Auto
Restart
Step 1