This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Re: Patch: finalize interned strings
- To: tromey at cygnus dot com
- Subject: Re: Patch: finalize interned strings
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Thu, 13 Apr 2000 09:01:47 +1200
- CC: Java Patch List <java-patches at sourceware dot cygnus dot com>
- References: <871z4bhwub.fsf@cygnus.com>
Hi Tom,
I actually did exactly this in my own tree last night, but didn't post the patch
because it is still buggy. _Jv_StringFindSlot() can get stuck in an infinate loop
looking for a slot when it encounters DELETED_STRINGs. I got rid of the
DELETED_STRING stuff (which I don't really understand), and then found that I was
still getting crashes that appeared to be collected Strings still present in the
hashtable.
I'm now wondering: Does the collector guarentee that finalizers will be run
immediatly when an object is collected? Or can the running of finializers be
deferred until a later collection in some cases?
regards
[ bryce ]
Tom Tromey wrote:
> I'm checking in this patch. It fixes a bug Bryce pointed out last
> night: Strings which are interned are never removed from the intern
> hash table, leading to crashes if they are GC'd and intern is used
> again.
>
> 2000-04-12 Tom Tromey <tromey@cygnus.com>
>
> * java/lang/natString.cc (unintern): Added `obj' argument.
> (intern): Register finalizer for string.
> * java/lang/String.java (unintern): Now static; added obj
> argument.