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

From: Doron Rajwan (doron@rajwan.org)
Date: Sat Apr 17 2004 - 15:59:49 EDT


First, this table is "native".

Second: there is no happens-before edge from the last
thread that dropped a hard reference to some object to
the first thread the calles WeakReference.get() and
receives null on that object.

Doron.

--- Eliot Moss <moss@cs.umass.edu> wrote:
> I suppose I stand corrected ... but I should add
> that the JVMs I tend to
> work with never unload classes, so string constants
> in loaded code go into
> a global table, from which they are never removed.
>
> If strings are actually interned, then there is an
> interning table
> somewhere. To be able to collect such strings, the
> table would have to
> operate using weak pointers (one of the
> java.lang.Reference
> classes). Perhaps it is indeed coded that way.
> However, if any thread has
> hold of such an object (e.g., via having
> synchronized on it but not yet
> released the lock), then the object will not be
> collected.
>
> Regards -- Eliot
>
> -------------------------------
> JavaMemoryModel mailing list -
http://www.cs.umd.edu/~pugh/java/memoryModel

=====
Doron Rajwan, mailto:doron@rajwan.org

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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