The analysis of the lifetime of objects in a garbage-collected system may
be accomplished quickly and effectively using reference counts and cyclic
garbage analysis. A reference count is maintained for each of the objects
to indicate the number of incoming pointers. Each time the graph
structure is altered, the reference counts are updated. Timestamps are
recorded each time the reference count for objects change. If a reference
count goes to zero, the corresponding object may be indicated as dead. A
garbage collection need only be run once (perhaps at the end), and after
it is run the system may indicate which objects are cyclic garbage. The
timestamps for objects which are cyclic garbage are then reviewed in
reverse chronological order. For each timestamp found, the corresponding
object and any object reachable from the corresponding object are
indicated as dead. These objects are then removed from the set of cyclic
garbage.