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=4.1 required=5.0 tests=AWL,DNS_FROM_RFC_POST, DNS_FROM_SECURITYSAGE,SPF_NEUTRAL 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 6D025BB84 for ; Fri, 14 Nov 2008 15:43:41 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgMDAEMdHUnAXQIngWdsb2JhbACTGz4BARYisSKLKAEDAQOCdYIK X-IronPort-AV: E=Sophos;i="4.33,603,1220220000"; d="scan'208";a="19191112" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 14 Nov 2008 15:43:41 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id mAEEheDB003112 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 14 Nov 2008 15:43:40 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvcAAMscHUlKfU4Zimdsb2JhbACTGz4BAQEKCQwHDwWxKYsoAQMBA4J1ggo X-IronPort-AV: E=Sophos;i="4.33,603,1220220000"; d="scan'208";a="17213275" Received: from ey-out-2122.google.com ([74.125.78.25]) by mail2-smtp-roc.national.inria.fr with ESMTP; 14 Nov 2008 15:43:40 +0100 Received: by ey-out-2122.google.com with SMTP id 25so539911eya.33 for ; Fri, 14 Nov 2008 06:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer:sender; bh=FnVaQH7Z2IucNgdGjcIpX4B9ce9yWGu8g93bChxOp6k=; b=EOuQ3EQHGplmBlULHP0G5heS6vRqhTudHkBcWUx08fnexugzSX2grP4wQLR12ARvPp 6DPKWXVbDRYp8E3ll78wb+hJE9HnKno/jHcgRp8iaa570/AuJjclY6wwMTz57UgSeBOZ 8L7XyUiiFNznXNrw9ZCEu/F3Is5j5YBY4Hs9U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer:sender; b=A1VLlub70JlXgVyIhs70/HXSqNOUkp2DGagrtpYfwOvCQbQ0jo6aW1YO4/uqkLnkjv wlCvyCZUMCL8iJiI66nA7ZPKWwAZpDAYP2Ss3pL5Hrf+WcK4BdweFBZtLOtMPkDlWVH0 P6WQKjj2fZR3Lrjclaco6fIV+xIlakM7b8hLA= Received: by 10.103.160.10 with SMTP id m10mr348183muo.50.1226673820247; Fri, 14 Nov 2008 06:43:40 -0800 (PST) Received: from ?192.168.1.34? (50-22.76-83.cust.bluewin.ch [83.76.22.50]) by mx.google.com with ESMTPS id i5sm2072087mue.11.2008.11.14.06.43.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 14 Nov 2008 06:43:39 -0800 (PST) Message-Id: <4A8FA99F-D6C3-4D99-AC8D-E17CEE94C88F@erratique.ch> From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= To: OCaml Mailing List In-Reply-To: <200811141503.43395.toots@rastageeks.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: [Caml-list] Big array with data managed by another value Date: Fri, 14 Nov 2008 15:42:38 +0100 References: <200811141503.43395.toots@rastageeks.org> X-Mailer: Apple Mail (2.929.2) Sender: =?UTF-8?B?RGFuaWVsIELDvG56bGk=?= X-Miltered: at concorde with ID 491D8E9C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bunzli:01 buenzli:01 bigarray:01 pointer:01 deallocated:01 bigarray:01 alloc:01 pointer:01 caml-list:01 data:02 data:02 caml:02 allocated:02 external:03 external:03 Le 14 nov. 08 =E0 15:03, Romain Beauxis a =E9crit : > We can pass the CAML_BA_EXTERNAL flag to the bigarray, so that the =20 > 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 =20= > the > original value should not be deallocated until we have finished =20 > dealing with > the returned bigarray. > > Is there a clean way to do that ? I'm not sure I understand what you want to do (what is the original =20 value ?). 1) If you are wondering about the original data of the allocated big =20 array then there is no such data if you use alloc_bigarray with =20 BIGARRAY_EXTERNAL. 2) If you are wondering about how you could deallocate the C pointer =20 using your own function whenever the bigarray becomes unreachable then =20= register the bigarray with Gc.finalise and an appropriate function. Best, Daniel