I'm working on an OCaml project which seems to have some problem of computational efficiency. While trying to find the bottleneck, I tried out of curiosity compiling to native code instead of bytecode, wondering how much the difference in running time would be.
It turns out that native code raises stack overflow. I tried executing with OCAMLRUNPARAM=b and I don't get much information about the stacktrace:
Fatal error: exception Stack overflow
Raised at file "map.ml", line 122, characters 10-25
Called from file "str.ml", line 259, characters 6-29
And nothing more. I don't know what's the point in my code which causes it. Furthermore, my program doesn't use large strings, so I don't get why Str should go stack overflow...
Is there some parameter I can tune to investigate the problem?
Strfunction to each of them usingList.mapthat is not tail recursive in the standard library. This is only a speculation, of course, but the first to come it mind :)Strwas over a small number of elements. I removed it, but the stack overflow still happens when I compile to native code.