-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Minor_heap_max and Max_domains as OCAMLRUNPARAM options #795
Comments
Update: I'm tentatively putting the allocation of -- When I change Where's the correct place to put the sampled GC stats? I could move it into It seems like a another option is to turn |
@sabine Thanks. Is there a branch where we can follow along this work?
I would think that this is the right approach. |
Here's the branch compare: https://github.com/ocaml/ocaml/compare/trunk...sabine:minor_heap_max_domains_OCAMLRUNPARAM_795?expand=1 I placed the allocations for the max_domain-length arrays from I don't understand yet, which method of allocating memory should be used here. I can see In Not sure where these should go. Considering it's domains-related, they could possibly be initialized during |
Don't use
|
The problem with things in systhreads is that these sits in However, maybe another solution would be to just use the systhreads entrypoints: |
I really don't want more hooks if possible. Callbacks are terrible in general and doubly so in C. |
Then we can move the handling of systhreads data structures within the runtime itself (would mean no hook, would be arguably cleaner.), but it would mean we now have references to systhreads in the runtime itself, sort of defeating the idea of having it sit in |
Hooks may be the simplest solution considering the alternatives. However, I don't know when they are supposed to free the memory? If the main domain terminating frees the memory, there may still be other threads (on other domains) that try to access Related to ocaml/ocaml#10865 (comment). Linux |
I added the remaining allocations behind a I left comments on all the allocations that link back to this issue and state that they're not freed. The code compiles and running the tests gives me
How do I go about testing further? E.g. do we already have some code on which to test Valgrind or AFL? Edit: do we need to use |
Thanks. Another point that we should discuss (upstream) is what the default values for If the program creates more domains than For AFL, now there is a test that checks whether the program can run. @jmid introduced For Valgrind, confirm if It would be best to discuss this on ocaml/ocaml. Can you make a PR to OCaml with the changes? |
Currently, both of these are defined in
runtime/caml/config.h
, withMinor_heap_max
defined as 2GB andMax_domains
as 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.My proposal is to make both
Minor_heap_max
andMax_domains
as OCAMLRUNPARAM options (whose default values can remain the same as now). With that change, we will be able to use AFL and Valgrind without having to have a separate compiler switch where these macros are defined to have much smaller values.AFL would use
Max_domains
as 1, andMinor_heap_max
to a small default such as 2 MB (non-determinism with multiple domains will affect AFL stability). Similarly, for valgrind, one you use a smallerMinor_heap_max
. I have confirmed that both AFL and valgrind work withMax_domains
as 1 andMinor_heap_max
as 2 MB.The text was updated successfully, but these errors were encountered: