patch for gc of interned String
Tom Tromey
tromey@redhat.com
Sat Mar 17 08:46:00 GMT 2001
>>>>> "Per" == Per Bothner <per@bothner.com> writes:
Per> That is ok - but what is not ok was that when an interned String
Per> is collected, there is nothing to remove it from the intern table
Per> - the code that does so is commented out ... Ooops.
Per> Does this look like a reasonable fix?
This patch doesn't work because of a race condition. Suppose this
sequence of events:
* "A" is interned
* "A" is noticed as being unreferenced and is collected
* Another thread does "A".intern
* Finalizer for "A" is run and removes String from table
That is, finalizers aren't run synchronously with respect to
collection.
I have a patch to fix this problem. It has been pending for a while.
You can see it on java-patches from a month or two ago.
I wasn't going to put it on the 3.0 branch but now I think maybe I
should. I haven't checked it in on the trunk because, even though I
tested the patch way back when, I want to be certain things compile
with it, and I haven't been able to build the trunk for a while.
Tom
More information about the Java
mailing list