Let, for example, all the .o modules were prepared, and we command 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. 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
participants (1)
-
Simon Marlow