Just a hint about why the destructor is not called is that when using caml_alloc_custom at https://github.com/libguestfs/libguestfs/blob/master/v2v/xml-c.c#L139, you are setting the used parameter to 0. As mentioned in http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual033.html#toc150 you can increase the ratio. A quick check would be to use a (used = 1, max = 1). From: rich@annexia.org At: Oct 6 2015 09:43:53 To: caml-list@inria.fr Subject: Re:[Caml-list] Finding "lost" references to OCaml heap values I guess I have two questions: (1) Is calling Gc.compact () guaranteed to call the finalizer of any object which is no longer reachable, under all circumstances? Or would there be some case where it wouldn't be called? (2) I have a large mixed OCaml / C program[a] where somehow calling Gc.compact isn't calling the destructor of a (very) large object. Manual code inspection has not revealed anything so far -- superficially it appears we are not holding any references to the object. Is there any method / library / tool that can inspect the OCaml heap and find references to an object? Rich. [a] https://github.com/libguestfs/libguestfs/tree/master/v2v -- Richard Jones Red Hat -- Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs