R
Robert Mischke
I've seen several remarks floating around the web that on some JVMs,
the use of String.intern() will lead to the interned Strings being
unreachable for garbage collection, ie the memory used by them is held
until the VM is restarted. However, I have not found such an assertion
in the regular Sun docs. In fact, I have found statements (e.g. at
www.mindprod.com/jgloss/interned.html) that this was a problem before
Java 1.2 but was resolved by the new weak references in 1.2.
Can anyone give a clear statement on what the current situation is? I
have several applications where String.intern() is a huge memory
saver, and I don't want to dismiss it just because of vague rumors.
If the problem still exists (which I don't hope), a list of the
affected VMs would be greatly appreciated.
Thanks in advance!
Robert
the use of String.intern() will lead to the interned Strings being
unreachable for garbage collection, ie the memory used by them is held
until the VM is restarted. However, I have not found such an assertion
in the regular Sun docs. In fact, I have found statements (e.g. at
www.mindprod.com/jgloss/interned.html) that this was a problem before
Java 1.2 but was resolved by the new weak references in 1.2.
Can anyone give a clear statement on what the current situation is? I
have several applications where String.intern() is a huge memory
saver, and I don't want to dismiss it just because of vague rumors.
If the problem still exists (which I don't hope), a list of the
affected VMs would be greatly appreciated.
Thanks in advance!
Robert