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 =&gt; [a] would do the trick.<div>
<br class="webkit-block-placeholder"></div><div>Cheers,</div><div>S.<br><br><div class="gmail_quote">On Tue, Jan 27, 2009 at 6:22 PM, Jake McArthur <span dir="ltr">&lt;<a href="mailto:jake@pikewerks.com">jake@pikewerks.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<div class="Ih2E3d"><br>
<br>
Henning Thielemann wrote:<br>
| in that module I defined the text to be printed as top-level<br>
| variable which might have been the problem. But this can&#39;t be the<br>
| problem of the compiled version of the program, where I encountered the<br>
| leak. So I have to keep on searching that leak.<br>
<br></div>
You have created a constant applicative form (commonly abbreviated CAF).<br>
GHC assumes that all top level declarations are constants, and simply<br>
does not garbage collect them. In the case of infinite structures, this<br>
can be a bad thing. This *does* affect even compiled code.<br>
<br>
The best way to avoid the problem, of course, is to avoid having<br>
infinite constants at the top level. Assuming that is impossible, your<br>
solution seems acceptable to me. Somebody more knowledgeable or creative<br>
than I may be able to come up with something nicer, though.<br>
<br>
- - Jake<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.9 (GNU/Linux)<br>
Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org" target="_blank">http://enigmail.mozdev.org</a><br>
<br>
iEYEARECAAYFAkl/lz0ACgkQye5hVyvIUKl0JgCgx5ddBc0Y44+ghFakr7Mex1RP<br>
zfUAnjh9BDI5+A9tEnaox20DbXbipX33<br>
=2MCw<br>
-----END PGP SIGNATURE-----<div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>