Mark and Sweep
Classic garbage-collection algorithm: mark all reachable objects, then free the unreachable ones.
As a program stores data on the heap, memory inevitably fills up. Garbage collection solves this by first marking all objects reachable from the program's roots—the stack, global variables, registers—then sweeping the heap and freeing everything not marked. John McCarthy introduced this for Lisp in 1960, and it remains one of the simplest and most reliable garbage-collection algorithms.