[gclist] When to garbage collect

P. T. Withington ptw@harlequin.com
Fri, 14 Nov 1997 13:05:52 -0500

At 11:07 -0600 11/14/97, David Gadbois wrote:
>   From: JanFriso.Groote@cwi.nl
>   Date: Fri, 14 Nov 1997 10:02:01 +0100 (MET)
>   I would like to know whether there exist references to papers
>   dealing with when to really do a Mark-Sweep garbage collection.
>There is some discussion in Jones' and Lin's book, but techniques for
>doing this well tend to be black art and highly application-specific.
>Most systems use 1) triggering when some absolute heap size is
>reached; 2) Doing some set amount of GC "work" per allocation; or 3)
>heuristicating based on how much space was recovered in previous

The Lisp Machine had three policies for its copying collector:

1) Ephemeral -- several levels of generational collection, collection
initiated when the level reached a particular target volume.  Typically the
older generations had a target volume 1/2 the generation that promoted into
it.  This results in the youngest generations never exceeding a fixed size,
as long as the program is well behaved (does not hold onto everything).

2) Dynamic -- objects promoted out of the oldest ephemeral level,
collection initated "at the last possible moment", that is, when a
collection could complete just before you would run out of swap space,
assuming a fixed rate of collection work per future allocation.

3) Static -- objects promoted out of dynamic, collection initiate manually,
typically when saving an image.

The fact that LispM servers often had "uptimes" measured in years is
evidence that this was a fairly successful policy.  Many people kept their
LispM workstations up for months on end keeping Dynamic collection off
during the day and running a Dynamic collection at night on a regular
basis.  There was also a fourth policy added in later years:

4) "GC-in-place" -- mark and sweep, initiated manually when there was
insufficient space to complete a copying GC and you could not afford to
reboot your machine.

This last policy was used by those folks who turned off Dynamic GC for too