For testing OCaml multicore, I installed opam version 4.12.0+domains+effects and implemented quicksort using tasks.
To my surprise, even the purely sequential version has very high memory consumption if run from within a thread pool (Domainslib) context: I see ocaml using 800 megabytes of RAM to sort an integer array of size 1 million if run within the following context:
let pool = Tsk.setup_pool ~num_additional_domains:3 () in
let run f = Tsk.run pool f in
The problem does not occur without this pool context.
Another surprising aspect: 256 gigabytes of virtual memory allocated for running anything inside ocaml.
If I run the computation over 4 threads, it dies before the end (but somehow the process returns 0).
Have I installed an incorrect version of ocaml multicore? What should I pick? (what opam command line ;) )