When `heapSizeSuggestionAuto` (-H) is set, the size of the nursery can grow continuously and never shrink, resulting in memory never being returned to the OS
Loading a big project into GHCi with +RTS -H
(turned on by default in ghc-bin.cabal.in
) causes the nursery size to quickly become very big:
Memory inventory:
gen 0 blocks : 2483 blocks ( 9.7 MB)
gen 1 blocks : 2043172 blocks (7981.1 MB)
nursery : 2034963 blocks (7949.1 MB)
empty pinned : 4214 blocks ( 16.5 MB)
retainer : 0 blocks ( 0.0 MB)
arena blocks : 1 blocks ( 0.0 MB)
exec : 0 blocks ( 0.0 MB)
GC free pool : 240 blocks ( 0.9 MB)
free : 1864899 blocks (7284.8 MB)
UpdRemSet : 0 blocks ( 0.0 MB)
total : 5949972 blocks (23242.1 MB)
Furthermore, in some circumstances it seems like the nursery doesn't seem to shrink, resulting in the memory never being returned to the OS:
Note the large difference in "Blocks size" and "live bytes". This discrepancy is entirely accounted for by the nursery.
Removing -H
bounds the nursery size to the size specified by -A
, and allows the memory to be returned to the OS