[Haskell-cafe] About garbage collecting

Brent Yorgey byorgey at gmail.com
Tue Nov 27 10:57:32 EST 2007

On Nov 27, 2007 10:43 AM, Maurí­cio <briqueabraque at yahoo.com> wrote:

> Hi,
> If available memory is low, is the
> garbage collector going to eliminate
> data that is still referenced, but
> it knows it can be recalculated when
> needed?

If I understand it correctly, when a thunk is evaluated, it is actually
replaced by its value in memory.  This suggests that once evaluated, it is
impossible to reconstruct the code that was actually used to produce a given
value (short of simply rerunning the entire program).  The overhead of
keeping around all the code necessary to reproduce any value would be
enormous and would clearly cause far more problems with regards to memory
usage than it solved. =)

As far as I know, the garbage collector only deallocates memory that is no
longer referenced.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071127/7ba51719/attachment-0001.htm

More information about the Haskell-Cafe mailing list