Summary
This chapter showed you a lot about garbage collection. You learned what garbage is, how it comes about, and saw two very different ways to deal with it. The easy way, popularized by some early Lisp systems and early versions of Python, is called reference counting. In reference counting, the allocated objects themselves are made responsible for their collection. This usually works.
The more difficult form of garbage collection involves finding all the live data in the program and usually moving it to avoid memory fragmentation. Finding the live data is generally recursive, requires traversing stacks to find references in parameters and local variables, and is usually an onerous and low-level task. Many variations on this general idea have been implemented. One of the primary observations, which some garbage collectors exploit, is that most allocated objects are used for only a short time and then become garbage almost immediately.
Any method you employ to save programmers...