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

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

On Thu, 04 Aug 2011 16:52:20 +0200
Oto Havle <havleoto@gmail.com> wrote:

>    I've found a thread from caml-list archives which suggests that calling 
> caml_{register/remove}_global_root from custom block finalizers might not be safe:
> http://www.mail-archive.com/caml-list@yquem.inria.fr/msg03746.html

No, this is not the case, quoting Xavier Leroy from that same thread:

> I foresee absolutely no problems with registering/unregistering global
> roots from a C finalizer.  As the manual states, the big no-no in
> C functions attached to custom blocks is allocating in the heap,
> either directly or via a callback into Caml or by releasing the global
> lock.  Within a finalizer, you should also refrain from raising an
> exception, as this would leave the GC is a bizarre state.  But global
> roots operations are OK.


Reply to: