Stack usage in OCaml function

I’m looking for a way to measure stack usage within an OCaml function.
I haven’t found how to do it using Gc.stats and I doubt Gc library is the right solution.
Can you give me some pointers?

1 Like

This should be available in Gc.stat starting with OCaml 5.5 .

For the current stack usage, you can copy the code for caml_current_stack_size in a C stubs from the PR above.

3 Likes