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


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.


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