[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#524908: libcairo-ocaml-dev: memory leak in Cairo_bigarray

tags 524908 + help upstream

Le 03/08/2011 08:22, Stéphane Glondu a écrit :
[...] Note that I have 32-bit system.

I didn't take this into account, and I can indeed reproduce the bug in
an up-to-date i386 sid chroot, with version 1:1.2.0-2.

By looking a bit deeper, I can observe that bug.ml fails on both bytecode and native, but nobug.ml fails only on native (and succeeds on bytecode as originally stated in the bug report).

Looking even further at the failing bytecode case, after instrumenting the code (cairo-ocaml and ocaml GC code), I can see that cairo_surface_t finalizer is always called when expected. ml_cairo_image_surface_create_for_data does register a global root, but caml_{register/remove}_global_root calls are always paired. I tried to remove the global root registration, and the problem disappears.

By the way, not all the recommendations from the section "Living in harmony with the garbage collector" of the manual are respected: there are many missing CAMLparam*, CAMLlocal* and CAMLreturn* invocations. I tried to add some, but was unsuccessful in solving the problem.

-dinstr output shows that the same code is generated for both versions, except for the additional Gc.compact call in nobug.ml.


Reply to: