RE: JavaMemoryModel: Finalization idioms

From: Eliot Moss (
Date: Mon May 02 2005 - 12:06:02 EDT

I'm missing something in this discussion ....

Folks Are talking about values in registers not being "seen" by a
GC. Whether something is in a register, thread stack, or heap, the GC had
BETTER find it! I suspect that what you are getting at has more to do with
something being thread-local than with it being in a register per se. And
if it is thread-local, never seen by another thread, then you are saying
that the point at which it becomes unreachable is not easy to capture,
given the range of optimizations allowed. Is this right?

In particular, I surmise that there is an issue something like this:

Thread T creates a thread-local object that has finalization, writes to it,
and then drops the pointer on the floor. The GC determines the object is
unreachable, and then the finalizer begins to run. But there is no
synchronization to guarantee that the original thread's writes are seen by
the finalizer. Is that the problem you are discussing? This has nothing to
do with registers -- only with the lack of synchronization between becoming
unreachable and having your finalizer run.

-- Eliot
JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:10 EDT