Resident set size exceeds +RTS -M limit with large nurseries
We observed high resident set size well in excess of the
+RTS -M limit in a long-running, high data-volume Haskell application that Awake Networks is deploying on a network appliance.
We think that the current
GC.c code has two bugs that, at least in combination with each other, become significant when high
+RTS -N and very high
+RTS -A values are used.
- As we approach the
-Mlimit, the computation of the new size for generation 1 appears to be based on an incorrect figure for the total size of the nursery. The
-Avalue is used instead of the product of that value with
-N. This problem could lead to the total heap size exceeding the
- Memory allocated from the operating system is freed only if the RTS thinks that it would not be reallocated soon. The estimate for what will be needed soon is based on fewer inputs than the actual resizing logic, and in particular it is not affected by
-M. Thus it might keep free mblocks in excess of the
-Mlimit, based on an expected heap growth that would be forbidden by
We prepared a fix to address these issues; it points out the particular lines of code: https://phabricator.haskell.org/D3143