[Haskell] memory management

Sebastian Sylvan sebastian.sylvan at gmail.com
Tue Aug 4 10:15:21 EDT 2009

On Tue, Aug 4, 2009 at 2:49 PM, Simon Marlow <marlowsd at gmail.com> wrote:

>  On 04/08/2009 13:33, Sam Martin wrote:
>> Sounds like region inference to me.
>>> (https://secure.wikimedia.org/wikipedia/en/wiki/Region_inference)
>> Thanks, yes, that's exactly what I had in mind.
>> Is anything like this is done in GHC?
> Not at the moment, no.
> Bear in mind that with generational GC, allocating memory that quickly
> becomes garbage is quite cheap.

Speculation time... I have no real basis for this, and I'm quite possibly
overlooking a lot of details...

There may be other benefits to doing this kind of escape-analysis, aside
from making short-lived allocations cheaper (which are indeed already quite
If you can associate a bunch of allocations with a point in the stack, even
if it's very low in the stack (and thus long-lived), there's a lot less work
that the GC needs to do to track all the other allocations (in the global
heap), since there's just fewer of them.

Also, each stack is associated with a specific thread, so it sort of brings
you half-way to per-thread GC, in the sense that all the stack-based
resource management is per-thread.

Sebastian Sylvan
UIN: 44640862
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell/attachments/20090804/7e63a169/attachment.html

More information about the Haskell mailing list