gpt4 book ai didi

java - 为什么会抛出OOM?

转载 作者:行者123 更新时间:2023-12-01 08:53:35 25 4
gpt4 key购买 nike

这是 server1 的堆内存信息

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 = 157286400 (150.0MB)
MaxPermSize = 157286400 (150.0MB)

Heap Usage:
PS Young Generation
Eden Space:
capacity = 19922944 (19.0MB)
used = 19911792 (18.989364624023438MB)
free = 11152 (0.0106353759765625MB)
99.94402433696546% used
From Space:
capacity = 12517376 (11.9375MB)
used = 0 (0.0MB)
free = 12517376 (11.9375MB)
0.0% used
To Space:
capacity = 13303808 (12.6875MB)
used = 0 (0.0MB)
free = 13303808 (12.6875MB)
0.0% used
PS Old Generation
capacity = 715849728 (682.6875MB)
used = 715848480 (682.6863098144531MB)
free = 1248 (0.001190185546875MB)
99.99982566173442% used
PS Perm Generation
capacity = 157286400 (150.0MB)
used = 79364440 (75.68782806396484MB)
free = 77921960 (74.31217193603516MB)
50.45855204264323% used

我分配了1024M内存给JVM Heap,但是JVM OOM时并没有用完内存

我有另一台服务器,下面是服务器OOM时的堆内存信息

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 = 157286400 (150.0MB)
MaxPermSize = 157286400 (150.0MB)

Heap Usage:
PS Young Generation
Eden Space:
capacity = 119341056 (113.8125MB)
used = 119253176 (113.72869110107422MB)
free = 87880 (0.08380889892578125MB)
99.92636230736889% used
From Space:
capacity = 111869952 (106.6875MB)
used = 0 (0.0MB)
free = 111869952 (106.6875MB)
0.0% used
To Space:
capacity = 111149056 (106.0MB)
used = 0 (0.0MB)
free = 111149056 (106.0MB)
0.0% used
PS Old Generation
capacity = 715849728 (682.6875MB)
used = 715849720 (682.6874923706055MB)
free = 8 (7.62939453125E-6MB)
99.99999888244702% used
PS Perm Generation
capacity = 157286400 (150.0MB)
used = 110605624 (105.48174285888672MB)
free = 46680776 (44.51825714111328MB)
70.32116190592448% used

这个服务器看起来简单正常,内存确实不够

谁能对server1 OOM提供清楚的解释

最佳答案

正如弗拉基米尔所说 - 你的 OldGen 已满,你应该检查 NewRatio 和 Survivor 比率。您还可以使用 gc 日志启动您的应用程序,并在外部工具中对其进行分析,例如:http://gceasy.io (免费)或 JClarity Censum(付费)

通过提供标志启用 gc 日志: -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log

关于java - 为什么会抛出OOM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42204067/

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