From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA05467; Thu, 25 Mar 2004 10:35:05 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA06033 for ; Thu, 25 Mar 2004 10:35:04 +0100 (MET) Received: from [192.168.0.2] (planar.net0.nerim.net [213.41.168.102]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i2P9ZdKW021764 for ; Thu, 25 Mar 2004 10:35:39 +0100 Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Damien Doligez Subject: Re: [Caml-list] Finalising bigarrays Date: Thu, 25 Mar 2004 10:35:06 +0100 To: caml-list@inria.fr X-Mailer: Apple Mail (2.613) X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; damien:01 damien:01 caml-list:01 bigarrays:01 shivkumar:01 bigarrays:01 descriptor:01 descriptor:01 one-to-one:01 reshape:01 overwrite:01 bigarray:01 bigarray:01 doligez:01 doligez:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 358 On Mar 25, 2004, at 02:01, Shivkumar Chandrasekaran wrote: > I tried calling Gc.finalise on a bigarray and it did not raise an > exception. Does that mean finalisation of bigarrays will work? A bigarray is composed of two things: a heap-allocated descriptor block that tells the number of dimensions, the layout, etc, and contains a pointer to the data. The data is in an out-of-heap block. When you call Gc.finalise, you are finalising the descriptor block. That would not matter if there was a one-to-one mapping between descriptor blocks and data blocks, but sometimes the data block is shared between bigarrays (when you call slice_left, slice_right, sub_left, sub_right, or the reshape functions). Your finalisation function is called when the bigarray itself is not used any more by your program, but you should beware that its data may be used by other bigarrays. Hence your finalisation function must not overwrite the data, unless you are really sure that it is not shared. -- Damien ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners