[Haskell-cafe] space leak with 'concat' ?
Jake McArthur
jake at pikewerks.com
Tue Jan 27 18:22:37 EST 2009
-----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-----
More information about the Haskell-Cafe
mailing list