Personal tools

Garbage collector

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(short explanation)
Line 12: Line 12:
* [[Research_papers/Runtime_systems#Garbage_collection Research papers]]
* [[Research_papers/Runtime_systems#Garbage_collection Research papers]]

Revision as of 17:35, 28 December 2008

A garbage collector deallocates unused allocated memory from time to time. This way, in Haskell memory deallocation can be hidden, making the language (more) declarative.

A simple idea of implementing a garbage collector would be to count the references to an object and delete the object, when the last reference disappears.

However in a cyclic data structures like
let x = 'a':x in x
, the
is referenced by itself, so that it would never get deallocated.

Thus garbage collection is a bit more complicated and thus needs more effort and phases, where it is applied. Garbage collection is also a bit difficult to handle with respect to real-time processing.

See also