On 2 February 2015 at 20:16, Jacques-Pascal Deplaix <[email protected]> wrote: > I'm wondering how the values (pointers allocated on the heap) created by a C > function, binded through ctypes should be freed. Is there a standard way to > do that ? > > In my example, the memphis library allocate some memory in > Memphis_renderer.create and should be freed via Memphis_renderer.destroy but > is there a way to call memphis_renderer_destroy automatically using the > OCaml GC ?
There are a few options. The simplest thing may be to add a finaliser (using Gc.finalise) to the pointer returned from Memphpis_renderer.create that calls memphis_renderer_destroy. _______________________________________________ Ctypes mailing list [email protected] http://lists.ocaml.org/listinfo/ctypes
