[Home]Garbage collection

HomePage | Recent Changes | Preferences

Difference (from prior major revision) (author diff)

Changed: 1c1,2
Garbage collection is a computing term that refers to a system of automatic [memory management]?. Commonly abbreviated as GC. A garbage collector is the part of a computer system that is responsible for recycling memory via garbage collection.
# Computer memory garbage collection
# [civic garbage collection]?

Removed: 3,18d3
The basic principle of automatic memory management is simple:
# determine what data objects in a program cannot possibly be needed.
# reclaim the storage used by those objects.

Garbage collectors use a reachability based criterion for determining whether a data object will be needed. At a particular moment when the collector decides that it needs to reclaim storage it will perform a garbage collection cycle. A cycle consists of the following steps:

# Create initial white, grey, and black sets; these sets will be used to maintain progress during the cycle. Initially the black set is empty, the grey set consists of specially denoted objects known as the "roots", and the white set is everything else. At any time in the algorithm a particular object will be in exactly one of the three sets.
# (This step is repeated until there are no objects in the grey set) Pick an object from the grey set, move that object from the grey set to the black set, move all the white objects that are referenced (reachable in one step of following pointers) from the selected object into the grey set.
# When there are no more objects in the grey set, then all the objects remaining in the white set are no reachable and the storage occupied by them can be reclaimed.

It comes in several forms. Two common types are [Mark sweep GC]? and [Copying GC]?. Somewhat orthogonal to these two paradigms are heuristic?s such as [Generational GC]? and [Incremental GC]?.

[Reference Counting]? is commonly referred to as garbage collection, but this usage is technically inaccurate. Garbage collection is reserved for algorithms and systems that determine the liveness of data based on reachability. Reference counting has serious problems anyway, such as a general inability to deal with circular references and a high overhead in both space and time.

Several good sources of more detailed GC information are http://www.memorymanagement.org/ [memorymanagement.org] and http://www.cs.utexas.edu/users/oops/papers.html [publications by the OOPS]] group at the University of Texas



Removed: 20d4


  1. Computer memory garbage collection
  2. [civic garbage collection]?

/Talk


HomePage | Recent Changes | Preferences
This page is read-only | View other revisions
Last edited October 9, 2001 6:45 pm by Drj (diff)
Search: