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
OCaml 4.13 memory leak in caml_setup_stack_overflow_detection #10698
Comments
Reported upstream as ocaml/ocaml#10698
Reported upstream as ocaml/ocaml#10698 (cherry picked from nbdkit commit 676c193ba05e479c145cf872e4912c576d1461d3)
Following an unhelpful change in glibc (#10250), there was an emergency fix in #10266, in particular to unblock the Rawhide builds. The emergency fix allocates the alternate signal stack dynamically, but does not free it because it's not entirely obvious how to do so safely (#10250 (comment)). Until this is addressed, your temporary fix (adding |
I don't disagree! That change has caused a huge amount of churn everywhere. Back to this bug though, since the alternate stack is not intended to be freed, would it make sense to rename the function |
Reported upstream as ocaml/ocaml#10698 (cherry picked from commit 676c193)
Reported upstream as ocaml/ocaml#10698 (cherry picked from commit 676c193)
Commit fc95347 introduced dynamic allocation of the alternate stack used to process signals. This commit makes sure the dynamically-allocated stack is freed when the main OCaml code terminates or an OCaml thread terminates. In passing, we also reset relevant signal handlers to their default behavior when the main OCaml code terminates. Fixes: ocaml#10698
Tentative fix in #10726. Needs testing. |
Commit fc95347 introduced dynamic allocation of the alternate stack used to process signals. This commit makes sure the dynamically-allocated stack is freed when the main OCaml code terminates or an OCaml thread terminates. In passing, we also reset relevant signal handlers to their default behavior when the main OCaml code terminates. Fixes: ocaml#10698
Commit fc95347 introduced dynamic allocation of the alternate stack used to process signals. This commit makes sure the dynamically-allocated stack is freed when the main OCaml code terminates or an OCaml thread terminates. In passing, we also reset relevant signal handlers to their default behavior when the main OCaml code terminates. Fixes: ocaml#10698
Commit fc95347 introduced dynamic allocation of the alternate stack used to process signals. This commit makes sure the dynamically-allocated stack is freed when the main OCaml code terminates or an OCaml thread terminates. In passing, we also reset relevant signal handlers to their default behavior when the main OCaml code terminates. Refactoring: add declaration of caml_init_signals and caml_terminate_signals to <caml/signals.h>. Fixes: ocaml#10698
Run any ocamlopt-compiled program under
valgrind --leak-check=full
and you will see:This leak seems to be new in OCaml 4.13.1.
In nbdkit we maintain a set of valgrind suppressions for OCaml, and the only ones we expect are functions matching
caml_stat_alloc*
: https://gitlab.com/nbdkit/nbdkit/-/blob/master/valgrind/ocaml.suppressionsThe text was updated successfully, but these errors were encountered: