
On 25/02/2012 16:51, Johan Tibell wrote:
Hi!
I'm trying to understand the interaction between the -A and -H RTS flags. The documentation at
http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/runtime-control.html
says that if you use -H (with or without an argument) it implicitly implies some value of -A. However, it's not clear to me what value -A will get and how that value is related to the value of -H. For example, if I set the suggested heap size to 1G, using -H1G, surely the size of the nursery (-A) won't be "whatever is left over," but something more reasonable e.g. the size of the L2 cache?
Perhaps it would make sense to document the actual algorithm used to set -A given -H (with and without argument.)
Hmm, I took a look at the docs and to me it seems clear (but it would do, since I wrote the docs :-) "Think of -Hsize as a variable -A option. It says: I want to use at least size bytes, so use whatever is left over to increase the -A value." Doesn't that describe exactly what it means? Well, actually it's a bit more complicated than that, and there are some heuristics involved. But the basic idea is to use all of the memory granted by -H for the heap, by increasing -A to fill any free space. The complications arise because we don't know how much of the nursery will need to be copied at the next GC, and the worst case (all of it) very often leaves a lot of memory unused, so we make an approximation. Sometimes this is an underestimate, and we end up using more memory than the -H value for a while. Whether -H is a good idea is not clear. When I added it, it was for backwards compatibilty with the previous GC, which had a fixed-size heap and required that you specify the heap size with -H. Cheers, Simon