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=1.0 required=5.0 tests=AWL,DNS_FROM_SECURITYSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 03660BB84 for ; Fri, 14 Nov 2008 15:03:44 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgMDAOQTHUnAXQIngWdsb2JhbACBbZFsAQEWIrxEgng X-IronPort-AV: E=Sophos;i="4.33,603,1220220000"; d="scan'208";a="19189277" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 14 Nov 2008 15:03:44 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id mAEE3hCr002127 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 14 Nov 2008 15:03:44 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgMDAHcTHUlYvxGEgWdsb2JhbACBbZFsAQEWIrxBgng X-IronPort-AV: E=Sophos;i="4.33,603,1220220000"; d="scan'208";a="19960298" Received: from www.rastageeks.org (HELO mail.rastageeks.org) ([88.191.17.132]) by mail1-smtp-roc.national.inria.fr with ESMTP; 14 Nov 2008 15:03:44 +0100 Received: from leonard.local (sphinx.lix.polytechnique.fr [129.104.11.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.rastageeks.org (Postfix) with ESMTP id E8B2CAA252 for ; Fri, 14 Nov 2008 15:03:43 +0100 (CET) From: Romain Beauxis To: caml-list@inria.fr Subject: Big array with data managed by another value Date: Fri, 14 Nov 2008 15:03:43 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811141503.43395.toots@rastageeks.org> X-Miltered: at concorde with ID 491D853F.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; pointer:01 bigarrays:01 bigarray:01 pointer:01 bigarray:01 deallocated:01 functions:01 data:02 data:02 caml:02 allocated:02 external:03 allocate:06 function:08 flag:09 Hi all ! In our application, we use a custom block to carry a pointer to data allocated by C. We would like to use this data with functions that use Bigarrays. Hence, we want a [custom_to_bigarray] function that would allocate a big array, and put our pointer as its data. We can pass the CAML_BA_EXTERNAL flag to the bigarray, so that the Gc doesn't touch data pointer when deallocating the returned array. However, what I don't know how to do yet is to also tell the Gc that the original value should not be deallocated until we have finished dealing with the returned bigarray. Is there a clean way to do that ? Romain