title: Optimize Haskell GC usage
body: <p>I am running a long-lived Haskell program that holds on to a lot of memory. Running with <code>+RTS -N5 -s -A25M</code> (size of my L3 cache) I see:</p>
  
  <pre><code>715,584,711,208 bytes allocated in the heap
  390,936,909,408 bytes copied during GC
    4,731,021,848 bytes maximum residency (745 sample(s))
       76,081,048 bytes maximum slop
             7146 MB total memory in use (0 MB lost due to fragmentation)
  
                                    Tot time (elapsed)  Avg pause  Max pause
  Gen  0     24103 colls, 24103 par   240.99s   104.44s     0.0043s    0.0603s
  Gen  1       745 colls,   744 par   2820.18s   619.27s     0.8312s    1.3200s
  
  Parallel GC work balance: 50.36% (serial 0%, perfect 100%)
  
  TASKS: 18 (1 bound, 17 peak workers (17 total), using -N5)
  
  SPARKS: 1295 (1274 converted, 0 overflowed, 0 dud, 0 GC'd, 21 fizzled)
  
  INIT    time    0.00s  (  0.00s elapsed)
  MUT     time  475.11s  (454.19s elapsed)
  GC      time  3061.18s  (723.71s elapsed)
  EXIT    time    0.27s  (  0.50s elapsed)
  Total   time  3536.57s  (1178.41s elapsed)
  
  Alloc rate    1,506,148,218 bytes per MUT second
  
  Productivity  13.4% of total user, 40.3% of total elapsed
  </code></pre>
  
  <p>The GC time is 87% of the total run time! I am running this on a system with a massive amount of RAM, but when I set a high <code>-H</code> value the performance was worse.</p>
  
  <p>It seems that both <code>-H</code> and <code>-A</code> controls the size of <code>gen 0</code>, but what I would really like to do is increase the size of <code>gen 1</code>. What is the best way to do this?</p>