Reduce "blocks needed" while using compacting GC
Currently the heuristic that GHC uses to determine when to release memory back to the operating system is too conservative in releasing memory when using the compacting GC (e.g. with +RTS -c
). In particular, the logic assumes that the copying GC will double the heap size during the next major GC. However, this is not the case when the compacting GC is in use.
Apart from the compacting GC issue, the +2
in this logic is quite brutal as even with the copying GC we are only certain to need oldGenFactor + 1
. Essentially we keep 100% more blocks than necessary. Perhaps this a reasonable default to avoid repeated allocation/deallocation (see #14702 (closed)) but I would argue that this would be left to the user. I suggest that we increase the default oldGenFactor
from 2 to 3 and meanwhile decrease the +2
to +1
.