[Haskell-cafe] space leak with 'concat' ?

Sterling Clover s.clover at gmail.com
Tue Jan 27 22:46:40 EST 2009

Note that only monomorphic declarations are CAFed. If you have an explicit
polymorphic signature, it will be treated as a function and
garbage-collected as usual. So if you have, e.g., a list of Doubles,
declaring it as foo :: Num a => [a] would do the trick.

On Tue, Jan 27, 2009 at 6:22 PM, Jake McArthur <jake at pikewerks.com> wrote:

> Hash: SHA1
> Henning Thielemann wrote:
> | in that module I defined the text to be printed as top-level
> | variable which might have been the problem. But this can't be the
> | problem of the compiled version of the program, where I encountered the
> | leak. So I have to keep on searching that leak.
> You have created a constant applicative form (commonly abbreviated CAF).
> GHC assumes that all top level declarations are constants, and simply
> does not garbage collect them. In the case of infinite structures, this
> can be a bad thing. This *does* affect even compiled code.
> The best way to avoid the problem, of course, is to avoid having
> infinite constants at the top level. Assuming that is impossible, your
> solution seems acceptable to me. Somebody more knowledgeable or creative
> than I may be able to come up with something nicer, though.
> - - Jake
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> iEYEARECAAYFAkl/lz0ACgkQye5hVyvIUKl0JgCgx5ddBc0Y44+ghFakr7Mex1RP
> zfUAnjh9BDI5+A9tEnaox20DbXbipX33
> =2MCw
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090127/eb223fef/attachment.htm

More information about the Haskell-Cafe mailing list