On 2019-03-15 19:06, Peter Levart wrote:
On 3/15/19 5:14 PM, Claes Redestad wrote:
Hi Peter,

thanks for reviewing!

Interning arbitrary attribute names might have some unfortunate side-
effects,

You mean if the number of different names would get larger and larger on a long-running JVM, the cache would grow without bounds?

Yes.


I noticed that the Name constructor:

         public Name(String name) {
             this.hashCode = hash(name);
             this.name = name.intern();
         }

...interns the String name. Do interned strings have a weak cache or are they kept for the entire life of JVM?

I think you can think of them as only weakly referenced by the VM, so
yes, they will be GCd if no-one keeps them alive.

/Claes

Reply via email to