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=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id BA05BBBCA for ; Sun, 11 May 2008 09:22:01 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvoBAAk7JkhQRFuwiGdsb2JhbACSCQEBAQ8glyg X-IronPort-AV: E=Sophos;i="4.27,468,1204498800"; d="scan'208";a="10591232" Received: from furbychan.cocan.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP; 11 May 2008 09:22:01 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1Jv5se-00037p-Kk; Sun, 11 May 2008 08:22:00 +0100 Date: Sun, 11 May 2008 08:22:00 +0100 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Ancient, concurrency, etc. Message-ID: <20080511072200.GA11772@annexia.org> References: <200805110515.52809.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200805110515.52809.jon@ffconsultancy.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; 0100,:01 pointer:01 ocaml:01 pointer:01 pointers:01 pulled:98 wrote:01 heap:01 heap:01 caml-list:01 int:01 caml:02 deallocate:03 float:03 float:03 On Sun, May 11, 2008 at 05:15:52AM +0100, Jon Harrop wrote: > If we have a type: > > type t = { x: float; n: int } > > with a value of that type in the ancient heap and we do: > > let local = { ancient with n=3 } > > then we have created a shallow copy that has now pulled a pointer to > the boxed float value in the ancient heap into our GC which will > later try to deallocate that float and crash. Is that correct? No. This creates a local value on the OCaml heap, containing a pointer to x on the ancient heap, but this won't cause a crash because the GC will just ignore that pointer. The problem, as you said earlier, is with pointers from ancient to the Caml heap, where you can end up with a dangling pointer (from ancient) which if followed would cause a crash or some other sort of nasty failure. (Not dissimilar to the case where you unmarshal something with the wrong type). Rich. -- Richard Jones Red Hat