harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Blewitt" <alex.blew...@gmail.com>
Subject Re: Re: Re: [drlvm] string interning in java
Date Sat, 29 Jul 2006 07:35:18 GMT
On 29/07/06, Robert Lougher <rob.lougher@gmail.com> wrote:
> The interned String table should be garbage-collected.  If the only
> reference to an interned String is from the class constant pool it
> will be collected when the class is unloaded.  If the intern table is
> preventing Strings from being collected it's a bug in the VM!

Garbage collection only occurs when there's no references left. String
literals in classes are stored in the constant pool; the constant pool
thus points to the (auto-intern()'d) Strings. So constant string
literals can never be garbage collected, regardless of whether an
intern()'d table is GC'd or not.

Ergo, any code of the form Message.get("some text") has just wasted
"somem text".length() chars in the intern() table permanently, until
that class gets unloaded, *regardless of whether that message is ever


Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message