Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958722

Pages: 1
Anonymous
Unregistered




What about 1.1 JVMs ?
      #4766 - 12/13/03 05:34 PM

Excellent article. Very informative. I'm on the way to look what is the behavior on Sun JRE 1.1.8, Kaffe and GCJ. Are the intern strings GC'ed ?

Post Extras: Print Post   Remind Me!   Notify Moderator  
vlad_roubtsov
member


Reged: 06/21/03
Posts: 169
Re: What about 1.1 JVMs ? [Re: Anonymous]
      #4769 - 12/13/03 07:17 PM

My gut feeling is that the early VMs did not bother to GC interned Strings, but I haven't done a systematic study of those.

Running the first code snippet in Sun's 1.1.8 VM does not show identity hashcode change. This is not a very conclusive test, however, because the low level format of object handles changed between Sun's 1.x and v2 VMs. Still, you can put together a simple testcase that creates and interns a large number of Strings and after a few thousand of those the 1.1.8 VM runs out of memory (despite the fact that the interned Strings are not retained anywhere in bytecode). This (and the fact that the same thing does not happen in recent VMs) shows that 1.1.8 VM likely keeps all interned Strings forever.

One of the points I was trying to make is that interning and GC'ing of String values are not mutually exclusive and it is even possible to snoop at how it happens in modern VMs. Thus, in a good VM String.intern() works like a weak map, which could be handy.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 6470

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5