gpt4 book ai didi

java - Interned 字符串不在 permgen 中?

转载 作者:太空狗 更新时间:2023-10-29 22:53:15 25 4
gpt4 key购买 nike

我在我们正在运行的 Java 应用程序上运行了 jmap -heap 命令,这是我得到的结果:

C:\Program Files\Java\jdk1.7.0_05\bin>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.

所以在 68mb 的 Permgen 中似乎有大约 89mb 的驻留字符串。是否存在未存储在 Permgen 中的驻留字符串?

最佳答案

来自 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.

关于java - Interned 字符串不在 permgen 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16297931/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com