Tomasz Zielonka wrote:
On Wed, Apr 19, 2006 at 01:56:25PM +0400, Bulat Ziganshin wrote:

generational GC (at least one used in GHC) is better suited for
"functional" (immutable) data. this conception by itself based on that
new allocated data can contain references to old ones but not vice
versa. minor GC algorithms scans only new data, if they don't contain
any references to some data cell (in new data), then all the heap
don't contain references to this cell and it can be freed. most of the
data in "normal" Haskell program are immutable so this works fine.


But most of the data is also lazy, and laziness in GHC is implemented
with mutation. I wonder how does GHC's GC handle thunk update.

Thunks are a special case, because they only mutate once. We have a write barrier in the thunk update code. Not much has changed in this regard since Sansom's original generational GC for GHC:

  http://citeseer.ist.psu.edu/sansom93generational.html

The GC has been replaced since then, and is now multi-generational rather than being fixed at 2 generations, amongst other things.

Cheers,
        Simon
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to