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.

Cheers,
S.

On Tue, Jan 27, 2009 at 6:22 PM, Jake McArthur <jake@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

iEYEARECAAYFAkl/lz0ACgkQye5hVyvIUKl0JgCgx5ddBc0Y44+ghFakr7Mex1RP
zfUAnjh9BDI5+A9tEnaox20DbXbipX33
=2MCw
-----END PGP SIGNATURE-----

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe