Mark-And-Sweep Garbage Collection

Mark-and-sweep garbage collection first marks all storage cells that are in use, then sweeps up all unmarked cells. Symbols are marked, and all pointers from the symbols are followed using the following recursive algorithm:

  1. If the pointer points to a symbol or to a marked pair, do nothing.

  2. Otherwise (pointer points to an unmarked pair),
    1. Mark the pair

    2. Apply the marking algorithm to the car of the pair.

    3. Apply the marking algorithm to the cdr of the pair.

Contents    Page-10    Prev    Next    Page+10    Index