avoid overriding the user's OCAMLRUNPARAM settings#83
Conversation
|
Note: I have not actually tested the control-flow path where the user sets OCAMLRUNPARAM and also sets the |
4a0b543 to
8df6dc1
Compare
|
I was concerned about how OCaml parses OCAMLRUNPARAM. From looking at startup_aux.c:98-161, the parser iterates left-to-right. Each key (like e) calls scanmult() which unconditionally overwrites the param. Comma is the separator (line 155). So for OCAMLRUNPARAM="e=10,e=20", last value wins (e would be 20). So olly's setting takes precedence over user defined values, as expected. The other issue is with duplicate env var entries, which isn't introduced here but I've gone back and read the POSIX spec for it. Happily linux glibc and macOS libsystem both scan linearly and return the first matching env var name so we get the olly one. The relevant section is POSIX.1-2017 Base Definitions, Chapter 8.1 "Environment
This means This fix is fine, I'll restructure all the env variable handling to do the right thing. |
|
Thanks! |
CHANGES: * Reinstate olly latency command. (tarides/runtime_events_tools#86, @tmcgilchrist) * Avoid overriding the user's OCAMLRUNPARAM settings. (tarides/runtime_events_tools#83, @gasche) * Remove help subcommand, as it relies on cmdliner internals. (tarides/runtime_events_tools#81, @theAlexes) * Fix cmdliner 2.0 compatibility. (tarides/runtime_events_tools#80, @krfantasy) * Log path when create_cursor raises an exception. (tarides/runtime_events_tools#66, @tmcgilchrist) * Add option to specify runtime events dir and log size. (tarides/runtime_events_tools#66, @tmcgilchrist)
CHANGES: * Reinstate olly latency command. (tarides/runtime_events_tools#86, @tmcgilchrist) * Avoid overriding the user's OCAMLRUNPARAM settings. (tarides/runtime_events_tools#83, @gasche) * Remove help subcommand, as it relies on cmdliner internals. (tarides/runtime_events_tools#81, @theAlexes) * Fix cmdliner 2.0 compatibility. (tarides/runtime_events_tools#80, @krfantasy) * Log path when create_cursor raises an exception. (tarides/runtime_events_tools#66, @tmcgilchrist) * Add option to specify runtime events dir and log size. (tarides/runtime_events_tools#66, @tmcgilchrist)
I wanted to use
olly latencyto measure the GC latency of a given program under different minor-heap-size settings. This does not work currently becauseollyoverrides the OCAMLRUNPARAM variable. The present PR ensures that the OCAMLRUNPARAM value is extended rather than forgotten.