Traditional garbage collection works by having the garbage collector call free, instead of the programmer.
The original garbage collection algorithm is know as
Mark and Sweep
There are two phases to this algoritm: the mark phase and the sweep phase.