Operating systems · interactive
Garbage collection
A garbage collector frees objects your program can no longer reach. Reference counting frees things the moment nothing points at them, but misses cycles. Mark and sweep traces from the roots and frees everything it didn't reach.
Filled: marked reachable. Dashed red: swept.
Mark and sweep starts from the roots: globals, the stack, registers.
Collector
Step 3 of 4 · read left to right
In production
Tools and technologies
Managed runtimes all trace the heap; some also count references.
Not tied to one language — use these names when you search docs or design a system.