Version française
Home     About     Download     Resources     Contact us    
Browse thread
BA: external managed data freed at finalisation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Florent Monnier <fmonnier@l...>
Subject: Re: [Caml-list] BA: external managed data freed at finalisation
> When a bigarray is created from C, where its data part is allocated
> from a C function, I would like to know how to handle the finalisation
> of this ba ?
>
> Will ocaml make the free() call on the data part when it will be
> finalised ?
>
> Should one associates a finalisation function and how ?

First I thought the solution could be to give CAML_BA_EXTERNAL to 
caml_ba_alloc()'s flags then changing the flags member of the returned ba 
adding CAML_BA_MANAGED to it. But now I think one should rather give 
CAML_BA_MANAGED to caml_ba_alloc() but with a non-null pointer, is it right ?