[kaffe] Re: Destroyed strings...

Patrick Tullmann tullmann at cs.utah.edu
Tue Jun 4 21:28:28 PDT 2002


Godmar wrote:
> Yes, don't do that.
> 
> It would mean you'd have to walk on egg shells when programming
> String and related classes in Java.

Of course...  And the current StringBuffer.toString() would have to be
completely tossed.


> Also, to unintern the string you don't have to access its content
> (or do you?)  Isn't that what Tim suggested?

Hmm... I can't see how that avoids the fundamental problem of a "live"
object with a pointer to dead space.

If I have a String sitting in the hashtable that is "dead", but not
yet removed, how is a random thread prevented from creating a new
String() with the same hashcode (and maybe the same contents) and
coming across this string-without-chararray object in the table?

I'd say this was totally and utterly broken, but it hasn't been the
pervasive problem I would except, so I must be missing something...

Perhaps the destroy() function on GC objects could be run while moving
white objects to the mustfree list in gc-incremental.c:finishGC?  That
would remove the Strings from the hashtable while the world is
stopped, thus preventing any mutators from seeing half-dead objects in
the string table.

-Pat

----- ----- ---- ---  ---  --   -    -      -         -               -
Pat Tullmann                                       tullmann at cs.utah.edu
	    He who dies with the most toys is still dead.




More information about the kaffe mailing list