Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: Ancient, concurrency, etc.
Date: Sun, 11 May 2008 08:22:00 +0100	[thread overview]
Message-ID: <20080511072200.GA11772@annexia.org> (raw)
In-Reply-To: <200805110515.52809.jon@ffconsultancy.com>

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


      reply	other threads:[~2008-05-11  7:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-10  9:09 Berke Durak
2008-05-10 11:17 ` Richard Jones
2008-05-10 12:24   ` Berke Durak
2008-05-11  4:15 ` [Caml-list] " Jon Harrop
2008-05-11  7:22   ` Richard Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080511072200.GA11772@annexia.org \
    --to=rich@annexia.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox