Garbage collection (computer science)

related topics
{math, number, function}
{system, computer, user}
{@card@, make, design}
{black, white, people}
{work, book, publish}
{disease, patient, cell}
{area, part, region}
{style, bgcolor, rowspan}

In computer science, garbage collection (GC) is a form of automatic memory management. It is a special case of resource management, in which the limited resource being managed is memory. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program. Garbage collection was invented by John McCarthy around 1959 to solve problems in Lisp.[1][2]

Garbage collection is often portrayed as the opposite of manual memory management, which requires the programmer to specify which objects to deallocate and return to the memory system. However, many systems use a combination of the two approaches, and other techniques such as stack allocation and region inference can carve off parts of the problem. There is an ambiguity of terms, as theory often uses the terms manual garbage collection and automatic garbage collection rather than manual memory management and garbage collection, and does not restrict garbage collection to memory management, rather considering that any logical or physical resource may be garbage collected.

Garbage collection does not traditionally manage limited resources other than memory that typical programs use, such as network sockets, database handles, user interaction windows, and file and device descriptors. Methods used to manage such resources, particularly destructors, may suffice as well to manage memory, leaving no need for GC. Some GC systems allow such other resources to be associated with a region of memory that, when collected, causes the other resource to be reclaimed; this is called finalization. Finalization may introduce complications limiting its usability, such as intolerable latency between disuse and reclaim of especially limited resources, or a lack of control over which thread performs the work of reclaiming.


Full article ▸

related documents
Gray code
Fuzzy control system
Lightweight Directory Access Protocol
Binary-coded decimal
Hamming code
Tar (file format)
Information theory
Reference counting
Dylan (programming language)
Self (programming language)
Structured programming
Programming language
Pascal (programming language)
Exception handling
Sorting algorithm
Monte Carlo method
BCH code
Halting problem
Basis (linear algebra)
Fundamental theorem of algebra
Dual space
Fermat number