From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 91261BBCA for ; Tue, 13 May 2008 18:51:22 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsAAANNjKUjVJFBbmWdsb2JhbACSEAEBAQEBCAUGCREDmms X-IronPort-AV: E=Sophos;i="4.27,480,1204498800"; d="scan'208";a="10674746" Received: from mx-out.libertysurf.net (HELO mail.libertysurf.net) ([213.36.80.91]) by mail2-smtp-roc.national.inria.fr with ESMTP; 13 May 2008 18:51:22 +0200 Received: from [192.168.1.2] (88.123.243.231) by mail.libertysurf.net (7.3.118.8) id 47F1FEBB00DB60E2 for caml-list@yquem.inria.fr; Tue, 13 May 2008 19:45:00 +0200 From: Florent Monnier Organization: l'Association Linux-Nantes To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] BA: external managed data freed at finalisation Date: Tue, 13 May 2008 18:59:32 +0200 User-Agent: KMail/1.8.2 References: <200805111649.32150.fmonnier@linux-nantes.fr.eu.org> In-Reply-To: <200805111649.32150.fmonnier@linux-nantes.fr.eu.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200805131859.32351.fmonnier@linux-nantes.fr.eu.org> X-Face: -0"dKXwF0PiXr]fa$^)NJY7$;waqUckGcM7&q,VU?Xv\[=CiVM]g]pDs^xmfU9+Q=Z,OdfMHUR-7Ao%evJh.=aiq,#r0Ux0dm'!l|zeAXj||$>1_(Lv4Hc",&F}sbHeK0`SBA$_|XP Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; bigarray:01 ocaml:01 alloc:01 flags:01 flags:01 alloc:01 pointer:01 caml-list:01 data:02 data:02 caml:02 caml:02 allocated:02 external:03 external:03 > 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 ?