Is it possible to limit the RAM the OCaml compiler is allowed to use (at the expense of speed)?
We’re hitting the 4GB limit on CircleCI with our OCaml project now, and I can’t find the equivalents of https://circleci.com/docs/1.0/oom/#setting-memory-limits-for-the-jvm for OCaml
@stedolan was kind enough to provide the answer to this:
the main tool for configuring space use is the space overhead parameter (OCAMLRUNPARAM’s o).
Try export OCAMLRUNPARAM="o=20" before running your program
Unlike java, you don’t specify a maximum heap size but instead a relative overhead: o=80 (the default) means that the heap is allowed to grow to the amount of live data in your program + 80%
Interestingly, @Drup points out that OCAMLRUNPARAM` affects any OCaml program, and since the compiler itself is an OCaml program, it’s affected!