I just installed OCaml under a VM and have a suggestion for improving the docs here: Get Up and Running With OCaml · OCaml Tutorials and here: opam - FAQ
Using Ubuntu under a VM I found that I could not get started with OCaml with 1GB of main memory. I recommend a small note for new starters to ensure that they set themselves up for success with >1GB of memory. I opted for 3GB which worked fine.
With 1GB main memory in a VM, Ubuntu runs well and installation of OCaml proceeds nicely until
`opam install dune utop ocaml-lsp-server`
when I found that the terminal window closes without any notice or error message. Increasing VM memory fixed the problem.
Without an intuition of OCaml’s memory requirements, this took some time to diagnose. The failure mode was silent, all that happened is that the Terminal window closed without warning.
All the best,
Maybe this would indeed deserve a mention. Out of curiosity, were many CPUs allocated to the VM? I would expect the memory consumption of the OCaml compiler to be that high only when compiling in parallel many large files.
Fresh vanilla install of Ubuntu and Opam and OCaml.
To be fair, most compilers are prone to the same problem: the assumption is typically that the machine will also have swap, so if memory is exhausted, programs will start paging out to the swapfile, not crashing with OOM.
VMs upend this assumption, since they’re often configured with no swap. By contrast, real machines rarely are.
It doesn’t seem like it’s the compiler but rather opam that’s hogging the memory. Perhaps when trying to solve the constraints for installing the three packages together? Is the solver very memory-hungry or something?