heap and code in ghci
Simon Marlow
simonmar@microsoft.com
Fri, 27 Apr 2001 11:32:40 +0100
> Let, for example, all the .o modules were prepared, and we=20
> command
> ghci ... +RTS -Mxxm -RTS
> ...
> Loading package std ... linking ... done.
> Prelude> :l BPrelude
> ...
>=20
> and then try to find sum [1..n].
> In my experiment
> xx =3D 7 does not allow to load the program,
> 8, sum [1..66000] yields "Heap exhausted",
> 10, sum [1..77000] yields 2964538500.=20
>=20
> Probably, this xx Mb is for binary program + heap.
> ghci loads .o modules, they take some part of xx,
> and all the rest is for the heap.
> Right?
Nope. The -M flag affects the size of the heap only; object files are
loaded outside the heap. If you're running out of heap with a maximum
size of 8M, it's probably because the heap is full of interfaces (i.e.
the in-memory copy of the .hi file).
Cheers,
Simon