Building on limited memory environments (or does -M really work?)

Saurabh Nanda saurabhnanda at
Sat Oct 21 12:36:19 UTC 2017


We're struggling to get our build pipeline working on CircleCI, which has a
4GB RAM limit. Here are some project stats to set the context:

- 1,200+ modules
- 36,315 LoC of Haskell
- On the local machine with -O1 -j the build takes approx 5.2 GB of RAM [1]

Trying to build on CircleCI with -O1 -j fails consistently, as expected.
However, the behaviour of -M -j -O1 is erratic, at best. Sometimes it
magically works, sometimes it fails. A number of times we've seen GHC take
3.5 GB (as reported by `top`), even though the limit was set to 2.5GB. Here
are flags that we've tried in various combinations we've tried. None of
them is consistent in building / failing:

* -O1
* -j
* +RTS -M2621440000 -RTS
* +RTS -A32m -RTS
* +RTS -n2m -RTS

What is the **real** behaviour of the -M option? How does it interact with
-j and -A?

[1] If I'm reading this correctly -

-- Saurabh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list