Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
341 views
in Technique[技术] by (71.8m points)

java - Interned strings not in permgen?

I've run the jmap -heap command on our running Java application and here's what I got:

C:Program FilesJavajdk1.7.0_05in>jmap -heap 2384 Attaching to process ID 2384, please wait... Debugger attached successfully. Server compiler detected.
JVM version is 23.1-b03

using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC

Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 1073741824 (1024.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 134217728 (128.0MB)
MaxPermSize = 201326592 (192.0MB)
G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 228261888 (217.6875MB)
used = 203794000 (194.3531036376953MB)
free = 24467888 (23.334396362304688MB)
89.28078260703775% used
Eden Space:
capacity = 202964992 (193.5625MB)
used = 198399360 (189.2083740234375MB)
free = 4565632 (4.3541259765625MB)
97.75053226913141% used
From Space:
capacity = 25296896 (24.125MB)
used = 5394640 (5.1447296142578125MB)
free = 19902256 (18.980270385742188MB)
21.325304100550518% used
To Space:
capacity = 25296896 (24.125MB)
used = 0 (0.0MB)
free = 25296896 (24.125MB)
0.0% used
concurrent mark-sweep generation:
capacity = 506445824 (482.984375MB)
used = 159479408 (152.09141540527344MB)
free = 346966416 (330.89295959472656MB)
31.489924576809226% used
Perm Generation:
capacity = 134217728 (128.0MB)
used = 72157448 (68.81470489501953MB)
free = 62060280 (59.18529510498047MB)
53.76148819923401% used

96874 interned Strings occupying 89695496 bytes.

So it seems like there are approximately 89mb of interned strings in 68mb of Permgen. Are there interned strings that are not stored in the Permgen?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From Java 7 release notes:

In JDK 7, interned strings are no longer allocated in the permanent generation of the Java heap, but are instead allocated in the main part of the Java heap (known as the young and old generations), along with the other objects created by the application. This change will result in more data residing in the main Java heap, and less data in the permanent generation, and thus may require heap sizes to be adjusted. Most applications will see only relatively small differences in heap usage due to this change, but larger applications that load many classes or make heavy use of the String.intern() method will see more significant differences.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...