[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Richard Jones <rich@a...> |
| Subject: | Re: [Caml-list] Re: Ancient, concurrency, etc. |
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