gpt4 book ai didi

java gc 100% 的 from 和 0% 的 to 空间

转载 作者:太空宇宙 更新时间:2023-11-04 06:13:54 25 4
gpt4 key购买 nike

遇到一个奇怪的问题,From 空间为 100%,to 空间始终为 0。谁能帮我离开这里?

jdk 1.8.25操作系统:linux

使用 JMAP 获取以下内容

Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 32212254720 (30720.0MB)
NewSize = 268435456 (256.0MB)
MaxNewSize = 268435456 (256.0MB)
OldSize = 31943819264 (30464.0MB)
NewRatio = 5
SurvivorRatio = 4
MetaspaceSize = 268435456 (256.0MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 268435456 (256.0MB)
G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 223739904 (213.375MB)
used = 113230096 (107.98463439941406MB)
free = 110509808 (105.39036560058594MB)
50.607913016714264% used
Eden Space:
capacity = 179044352 (170.75MB)
used = 68534544 (65.35963439941406MB)
free = 110509808 (105.39036560058594MB)
38.27797036568906% used
From Space:
capacity = 44695552 (42.625MB)
used = 44695552 (42.625MB)
free = 0 (0.0MB)
100.0% used
To Space:
capacity = 44695552 (42.625MB)
used = 0 (0.0MB)
free = 44695552 (42.625MB)
0.0% used
concurrent mark-sweep generation:
capacity = 31943819264 (30464.0MB)
used = 390280592 (372.20057678222656MB)
free = 31553538672 (30091.799423217773MB)
1.2217718513072038% used

在gc.log中,它总是说“分配失败”,我该如何更改“幸存者大小”?

[GC (Allocation Failure) 10.371: [ParNew Desired survivor size 22347776 bytes, new threshold 15

最佳答案

“分配失败”是minor GC的正常原因(较旧的JVM不会打印原因,但总是分配失败)。

“To space”应该始终为空(在 Stop-the-World GC 阶段它不为空,但 GC 完成后它始终为 0%)。

100%“来自太空”也可以。通常,JVM 会调整保有阈值以保持“来自空间”尽可能接近 100%。不过,将其精确设置为 100% 意味着某些对象会过早升级。

生存空间的大小由-XX:SurvivorRatio=N选项控制。使用 -XX:+PrintTenuringDistribution 对于调整 young GC 非常有用。

Here可以找到更多与GC调优相关的JVM选项。

关于java gc 100% 的 from 和 0% 的 to 空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28348299/

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