Understanding the -A and the -H flags

Simon Marlow marlowsd at gmail.com
Tue Feb 28 09:57:05 CET 2012

On 27/02/2012 17:34, Johan Tibell wrote:
> Hi Simon,
> On Mon, Feb 27, 2012 at 12:25 AM, Simon Marlow<marlowsd at gmail.com>  wrote:
>> "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?
> Maybe. Let me start with the mental model I approach this with: the
> allocation area (i.e. the nursery) should have a size in the order of
> megabytes, often around the size of the L2 cache.

Ah, so I see where your confusion arises - this assumption is not true 
in general.  Just discard the assumption, and I think everything will 
make more sense.

Picking a size for -A around the L2 cache is often a good idea, but not 
always.  GHC defaults to -A512K, but programs that benefit from much 
larger sizes are quite common.  For more about the tradeoff, see my SO 
answer here:


> Given this model, I read the above as:
>   * if you set e.g. -H1G, you'll get an allocation area which is in the
> order of 1Gb large. That makes no sense to me.

Right - see above.  In fact there's no problem with a 1GB nursery.

>   * The suggested size of the total heap (-H) has something to do with
> the size of the allocation area (-A). This makes no sense to me
> either.
> So either I do understand what -H does, but it makes no sense to me,
> or I don't understand what -H does, but what it does makes sense.
> Perhaps the confusion lies in the phrase "left over." Left over from what?

Left over after the memory required by the non-nursery parts of the heap 
has been deducted.


More information about the Glasgow-haskell-users mailing list