This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: finalize interned strings


Jeff Sturm wrote:

> I was considering race conditions.  Imagine this: an interned string
> becomes collectable so it is scheduled for finalization.  But before
> finalization can occur, another thread calls intern() and grabs a
> reference to the finalizing string object.  When finalization does occur
> it becomes uninterned but is not collected because it is no longer a
> dead object.  And the thread that called intern() thinks it has an
> interned string, but doesn't.

I don't think this can happen with our particular gc implementation,
because it stops all threads before marking begins. But perhaps this could
be a problem with concurrent collectors.

> FWIW it took Sun a long time to get this right... versions of the JDK
> prior to 1.2 never released interned strings.

Yeah, I don't think Kaffe does either.

regards

  [ bryce ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]