[Haskell-cafe] space leak with 'concat' ?
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:
> -----BEGIN PGP SIGNED MESSAGE-----
> 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> -----END PGP SIGNATURE-----
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe