LLVM+OCaml Bindings for the latest LLVM is slower than 2.6

LLVM-2.6 takes 3s from OCamlbuild, but the lastest LLVM (I am using
r95712) takes 34s. I attached the code.
But the new LLVM fixed a problem of dispose_module in 2.6.

I got this error in 2.6, but the new LLVM works well.

While deleting: [14 x i8]* %greeting
An asserting value handle still pointed to this value!
UNREACHABLE executed at

I had some problem to debug assertions in C++ from OCaml, so did not
figure out the root cause yet.
But it is fixed anyway.

Do we need to expliciltly release (dispose_module) a module in OCaml
at the end of a program?
The C++ tutorial does not call dispose_module in C++. When should I
use this interface?


Test.ml (1.32 KB)

Provided that is just manual memory management leaked into OCaml from the C++
side, the sane thing to do would be to wrap the module in an object and give
it a finalizer that called dispose_module when OCaml's GC collected the
object. The only non-trivial aspect is making sure that the OCaml
representation of the module keeps references to anything that refers back to
it on the C++ side to ensure that it is not prematurely collected.