Summary
This chapter has presented the principal families of algorithms for
automatic memory reclamation with the goal of detailing those used in
Objective CAML. The Objective CAML garbage collector is an incremental garbage
collector with two generations. It uses Mark&Sweep for the old generation,
and Stop&Copy for the young generation. Two modules directly linked to the
garbage collector allow control of the evolution of the heap. The
Gc module allows analysis of the behavior of the garbage
collector and modification of certain parameters with the goal of
optimizing specific applications. With the Weak module one
can save in arrays values that are potentially reclaimable, but which
are still accessible. This module is useful for implementing a memory
cache.