Like most optimizations, interning strings shouldn't be done arbitrarily, but it can be effect-
ive if there are lots of duplicate strings occupying a significant portion of the heap. One
caveat about interning too many strings is that the table of interned strings—which is held in
native memory—is a fixed-size hashtable. In releases prior to Java 7u40, the default size of
the table is 1,009 buckets; on average, then, it can be expected to hold about 500 strings be-
fore there are collisions due to chaining. In 64-bit versions of Java 7u40 and later, the default
size is 60,013.