简体   繁体   English

确定Java内存不足错误的根本原因

[英]Determine root cause of java out of memory error

I am getting a websphere error..on further research it was mentioned that it was due of Java Out of memory. 我遇到了一个Websphere错误。在进一步研究中,有人提到这是由于Java内存不足所致。 I am not familiar with JAva Heap and GC. 我对JAva Heap和GC不熟悉。 I just modified few classes of code for an enhancement. 我只是修改了几类代码以进行增强。 This applicaiton had no issues until now. 到目前为止,该申请没有任何问题。 Therefore I am leaning towards the modified code is causing issues. 因此,我倾向于修改后的代码导致问题。

How do I determine which object(s) is causing the oom error. 如何确定导致oom错误的对象。

检查您是否递归调用任何方法或无限循环而没有任何中断,否则您应该共享您的代码以使我们能够为您提供帮助

Post the error message. 发布错误消息。 It could be you have to increase the heap size (using -Xmx xxxx flag) because the application just needs some more memory than it used to (for whatever reason noone can tell by the information you have given). 可能是您必须增加堆大小(使用-Xmx xxxx标志),因为该应用程序只需要比以前多的内存(无论出于何种原因,没人可以通过您提供的信息来分辨该内存)。 You could also use -XX:+HeapDumpOnOutOfMemoryError to get more information. 您也可以使用-XX:+HeapDumpOnOutOfMemoryError来获取更多信息。

Take a heap dump and thread dump when ever oom error occur it help to find the rca for this 发生oom错误时进行堆转储和线程转储,有助于为此找到rca

Increse your jvm heap size as Xms as 512 and Xmx 1024 将jvm堆大小增加为Xms(分别为512和Xmx 1024)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM