gpt4 book ai didi

java - 对于我的 gc 输出,什么是好的 gc 调整策略?

转载 作者:行者123 更新时间:2023-12-02 00:52:54 26 4
gpt4 key购买 nike

这是运行大约 10 分钟后的输出。

Heap
PSYoungGen total 7040K, used 0K [0x24060000, 0x247c0000, 0x26790000)
eden space 6528K, 0% used [0x24060000,0x24060000,0x246c0000)
from space 512K, 0% used [0x246c0000,0x246c0000,0x24740000)
to space 512K, 0% used [0x24740000,0x24740000,0x247c0000)
ParOldGen total 48896K, used 43303K [0x06990000, 0x09950000, 0x24060000)
object space 48896K, 88% used [0x06990000,0x093d9d80,0x09950000)
PSPermGen total 12288K, used 3737K [0x02990000, 0x03590000, 0x06990000)
object space 12288K, 30% used [0x02990000,0x02d366c0,0x03590000)
[GC [PSYoungGen: 0K->0K(7040K)] 43303K->43303K(55936K), 0.0005129 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[Full GC (System) [PSYoungGen: 0K->0K(7040K)] [ParOldGen: 43303K->43303K(48896K)] 43303K->43303K(55936K) [PSPermGen: 3737K->3737K(12288K)], 0.1964557 secs] [Times: user=0.36 sys=0.00, real=0.19 secs]

提前致谢

最佳答案

我建议使用 JConsole (JDK 1.5+) 或 jVisualVM (JDK1.6) 之类的东西。 printgc 的单个输出不足以提供良好的推荐。

通常有两个问题:创建了太多新对象,新生代很快就填满了,因此 gc 将所有这些对象移动到幸存者空间甚至永久代。如果发生这种情况(它们会在下一次完整GC时被删除,这需要更长的时间),我建议增加年轻/新一代。 (-XX:新尺寸)。这使得对象可以被常规垃圾回收取消引用并删除。

如果您确实有许多长期存在的对象,我会检查这是否真的有必要。这可能意味着您必须更改代码。

请记住,与小堆相比,大堆需要更长的时间进行垃圾回收。

关于java - 对于我的 gc 输出,什么是好的 gc 调整策略?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2271204/

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