[Haskell-cafe] Re: Looking for the fastest Haskell primes

Jules Bean jules at jellybean.co.uk
Thu Apr 16 07:23:51 EDT 2009


Eugene Kirpichov wrote:
> The parameterless version is a top-level definition and won't get
> garbage-collected, IIRC.

This has not-much to do with CAFs and is really just about scope + 
values + liveness. live values (those which a program still refers to, 
e.g. from a function which might get called in the future) don't get GCed.

CAFs are just in the top-most scope and particularly likely to get held 
live in this fashion.

As Lennart points out, optimisations occasionally increase sharing, 
although GHC tries fairly hard not to do this.

Jules


More information about the Haskell-Cafe mailing list