heap and code in ghci
Fri, 27 Apr 2001 14:26:17 +0400
To my request
>> I cannot find where it is explained the memory distribution used by
Simon Marlow writes
> Interpreted code lives in the heap, and is garbage collected as normal.
> Object code is loaded outside the heap. It takes up real memory
> in the process, because the data has to be relocated when it is
Let, for example, all the .o modules were prepared, and we
ghci ... +RTS -Mxxm -RTS
Loading package std ... linking ... done.
Prelude> :l BPrelude
and then try to find sum [1..n].
In my experiment
xx = 7 does not allow to load the program,
8, sum [1..66000] yields "Heap exhausted",
10, sum [1..77000] yields 2964538500.
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.
Thank you in advance for the explanation.