How to find out which function causes Exception “Stack_overflow” in OCaml

My OCaml program prints:

Fetal error: Exception "Stack_overflow"

without any further information.

How to find out which function causes this “Stack_overflow” exception?

First, recompile your OCaml program with -g.

Second, rerun your OCaml program with OCAMLRUNPARAM=b and the backtrace will be printed out after the “Stack_overflow” exception.

Leave a Reply

Your email address will not be published. Required fields are marked *