Tuesday, 15 June 2010

garbage collection - Will Java's interned strings be GCed? -


While tracing a potential memory leak, I came to the following incident. Is Java 7 not accurate to internal string or JMAP?

 # jmap -heap 9724 | Grep interned ID 9724 Attached to the process, please wait ... The server has been successfully connected JMM version 23.3-B01 10526 internal strings are captured 880048 bytes. #Jmap -heap 9724 | Grep interned ID 9724 Enclosed to process, please wait ... The server has been successfully linked to the server compiler JMM version 23.3-B 101 10514 are the internation strings on which 878984 bytes are. #Jmap -heap 9724 | Grep interned id 9724 Enclosed to process, please wait ... The server has compiled successfully the debugger JMM version 23.3-B 101 1059 internal strings are 879720 bytes.  

Environment: Linux version 2.6.32-220.23.1.el6.centos.plus.x86_64 (mockbuild@c6b5.bsys.dev.centos.org) (GCC version 4.4.6 20110731 (Red Hat 4.4 .6-3) (GCC)) # 1 SMP Tuesday, June 19 04:14:37 BST 2012

Java version "1.7.0_07" Java (TM) SE Runtime Environment (Build 1.7.0_07-B 10) Java HotSpot (TM) 64-bit server VM (23.3-B01, creation of mixed mode)

Yes the internal string is retrieved. And as mentioned in this it is proposed:

In JDK 7, the interned strings are no longer allocated in the permanent generation of Java stacks, rather its main parts Are allocated in Java pile (known as young and old generations), along with other items made by the application. As a result of this change, there will be less data in the main java stack and lesser figures in permanent generation, and thus the size of the pile may be required to adjust. Due to this change, only relatively small differences will appear in Hep Usage in most applications, but large applications that load multiple classes or use the String.intern () method heavier, they will see a more significant difference.

No comments:

Post a Comment