Next: , Previous: , Up: Data Representation   [Contents][Index]
9.2.4 Conservative Garbage Collection  Aside from the latent
typing, the major source of constraints on a Scheme
implementation’s data representation is the garbage collector.
The collector must be able to traverse every live object in the
heap, to determine which objects are not live, and thus
collectable.  There are many ways to implement this. Guile’s
garbage collection is built on a library, the Boehm-Demers-
Weiser conservative garbage collector (BDW-GC). The BDW-GC “just
works”, for the most part. But since it is interesting to know
how these things work, we include here a high-level description
of what the BDW-GC does.  Garbage collection has two logical
phases: a mark phase, in which the set of live objects is
enumerated, and a sweep phase, in which objects not traversed in
the mark phase are collected. Correct functioning of the
collector depends on being able to traverse the entire set of
live objects.  In the mark phase, the collector