Thank you for the feedback.
Does that mean declare the result using CAMLlocal and call CAMLdrop before return?
After read the caml/memory.h headers I think it is so. Incidentally, I find that the random crashing in the other http server library I’m using could also be caused by not playing nice with OCaml GC in C code.