-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Means of limiting how much memory is being reserved by the runtime, so that Valgrind and AFL can be used #10971
Description
It became clear in #10955 that a proper functionality and design discussion needs to happen.
Feature Proposal
We need a means of limiting how much memory is being reserved by the runtime, so that we can run Valgrind and AFL.
In general, it would be good to give the programmer more control over the amount of virtual memory that the OCaml runtime reserves.
@kayceesrk in ocaml-multicore/ocaml-multicore#795
Currently, both [Max_domainsandMinor_heap_max] are defined in runtime/caml/config.h, withMinor_heap_maxdefined as 2GB andMax_domainsas 128. This makes Multicore OCaml programs use at the minimum 256GB of virtual address space. This causes problems for tools like AFL and Valgrind, which cannot seem to deal with mmap reserve and expects to commit that much memory, and hence run out of memory on Multicore OCaml.
Failed Implementation
- (Make Minor_heap_max and Max_domains OCAMLRUNPARAM options #10955).
- Lowering the default value of
Minor_heap_maxis not desirable: a large number of existing programs programmatically increase the size of the minor heap usingGc.set, and we cannot break this functionality.
- Lowering the default value of
Goals
- No limit on the number of domains that can be spawned
- No limit on the the program changing the size of the minor heap
- No new OCAMLRUNPARAM parameters
- Valgrind works out of the box, AFL works with the
-m noneoption