From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA21769 for caml-red; Thu, 14 Dec 2000 19:26:40 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA00676 for ; Thu, 14 Dec 2000 00:06:57 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eBDN6uH21289; Thu, 14 Dec 2000 00:06:56 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id AAA32593; Thu, 14 Dec 2000 00:06:50 +0100 (MET) Date: Thu, 14 Dec 2000 00:06:49 +0100 From: Markus Mottl To: Xavier Leroy Cc: OCAML Subject: Re: fancy GC question Message-ID: <20001214000649.A26410@miss.wu-wien.ac.at> References: <20001212040549.A5381@miss.wu-wien.ac.at> <20001212163839.B26381@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20001212163839.B26381@pauillac.inria.fr>; from Xavier.Leroy@inria.fr on Tue, Dec 12, 2000 at 16:38:39 +0100 Sender: weis@pauillac.inria.fr On Tue, 12 Dec 2000, Xavier Leroy wrote: > It is safe if the C code does not perform any allocation in the Caml > heap while it is using the "ar" pointer. An allocation can trigger a > garbage collection, which can move the Caml block denoted by "v_ar"; > after this, the "ar" pointer no longer points inside the block! Yes, this should also be avoided. Another problem that comes to my mind now is that this makes it rather unwise to use the "enter/leave_blocking_section"-functions when using this trick: another thread could then trigger a collection while the C-function is still writing to the array - right? > > Can other effects mess up the > > fact that the pointers map continuously on a contiguous chunk of memory > > (of integers)? > > I'm not sure I understand the question, but the various "fields" of a > Caml block (as accessed with the Field macro) are always contiguous in > memory. Ah, stupid thinking on my side - I get schizophrenic after four o'clock in the morning and pose several questions in one (everything clear now)... ;) - Markus -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl