opam icon indicating copy to clipboard operation
opam copied to clipboard

make cold gets OOM-killed on machines with limited amount of RAM

Open kit-ty-kate opened this issue 5 months ago • 1 comments

make cold uses make -j which calls a potentially infinit number of processes in parallel. These processes can sometimes each take a substantial amount of RAM, which gets these processes killed by the system.

https://github.com/ocaml/opam/blob/708d62ec2b020fb1f176f7f8184f93bd1259496d/shell/bootstrap-ocaml.sh#L148

I can see two ways of fixing it:

  • either limit the number of processes to something like 8 (or whichever number a typical 1GB machine can handle). For higher end machines things might get a bit slower but typically not that much for a build of the compiler.
  • or find the command to get the current number of processes on each platforms we support (e.g. nproc on linux)

kit-ty-kate avatar Jun 11 '25 12:06 kit-ty-kate

We should add --disable-dependency-generation to the configure options (there's already --disable-stdlib-manpages there.

Do the machines which are getting OOM fail with -j16? Testing on one of the high-core machines here (and based on previous benchmarking), the difference between -j16 and -j32 is fairly small, but -j8 vs -j16 is significant.

dra27 avatar Jun 16 '25 13:06 dra27