Re: JavaMemoryModel: String literals and String.intern()

From: Eliot Moss (
Date: Sat Apr 17 2004 - 17:12:01 EDT

OK, one more shot at this ....

It would appear that the problem is really only one of _specification_,
i.e., that there is nothing in the model _requiring_ a happens-before edge
where you might want it.

On the other hand, if there is an intervening garbage collection, I claim
that all threads have synchronized (one way or another) with the GC, and
thus before-GC and after-GC events are in fact all ordered, even though
there is no spec requiring it. It is a property implied by the
implementation of GC. The logic is something like this:

Thread 1 accesses the interned string
GC reclaims it (which must come after Thread 1's access)
Thread 2 interns it again (which must come after the GC's reclamation of

Perhaps what we need is something about happens-before edges related to GC
and Reference objects?

-- Eliot
JavaMemoryModel mailing list -

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