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 RAA14907 for caml-redistribution; Tue, 1 Jun 1999 17:13:33 +0200 (MET DST) 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 MAA30538 for ; Mon, 31 May 1999 12:09:59 +0200 (MET DST) Received: from maxime.u-strasbg.fr (maxime.u-strasbg.fr [130.79.75.36]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id MAA25495 for ; Mon, 31 May 1999 12:09:57 +0200 (MET DST) Received: (from luther@localhost) by maxime.u-strasbg.fr (8.8.7/8.8.7) id MAA21017; Mon, 31 May 1999 12:11:23 +0200 (MET DST) Message-ID: <19990531121123.A20994@maxime.u-strasbg.fr> Date: Mon, 31 May 1999 12:11:23 +0200 From: Sven LUTHER To: Manuel Fahndrich , "'caml-list@inria.fr'" Subject: Re: OCaml - CInterface: interesting bug scenario Reply-To: luther@dpt-info.u-strasbg.fr References: <783D93998201D311B0CF00805FEAA07B7E8DD2@RED-MSG-42> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: <783D93998201D311B0CF00805FEAA07B7E8DD2@RED-MSG-42>; from Manuel Fahndrich on Thu, May 27, 1999 at 02:58:18PM -0700 Sender: weis On Thu, May 27, 1999 at 02:58:18PM -0700, Manuel Fahndrich wrote: > The scenario looks like a rare event, but I was able to observe this bug > consistently. There are several fixes one can imagine: > > 1) keep ML and C blocks separate throughout the lifetime of a process. > > 2) Box every C pointer inside an abstract ML block. This way, the garbage > collector will never look at the pointer. Unfortunately this causes a lot of > extra allocation and indirection. > > 3) Tag C pointers as integers by setting the least significant bit whenever > the pointer is passed to ML or stored in the ML heap. Similarly, clear the > bit whenever the pointer is examined on the C side. Another solution would be to wrap the malloc and other such functions, to inform the caml system that the block as been freed, would it not ? Friendly, Sven LUTHER