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

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


Hi,

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 -
https://gist.github.com/saurabhnanda/c8f8654a7f29c1adb753b357b897b5f3#file-building-library-01-txt-L8-L12

-- Saurabh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20171021/2abfa4e8/attachment.html>


More information about the ghc-devs mailing list