Re: OCaml - CInterface: interesting bug scenario

From: Sven LUTHER (luther@maxime.u-strasbg.fr)
Date: Mon May 31 1999 - 12:11:23 MET DST


Date: Mon, 31 May 1999 12:11:23 +0200
From: Sven LUTHER <luther@maxime.u-strasbg.fr>
To: Manuel Fahndrich <maf@microsoft.com>,
Subject: Re: OCaml - CInterface: interesting bug scenario
In-Reply-To: <783D93998201D311B0CF00805FEAA07B7E8DD2@RED-MSG-42>; from Manuel Fahndrich on Thu, May 27, 1999 at 02:58:18PM -0700

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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:22 MET