简体   繁体   English

“ OutOfMemoryError”的其他原因?

[英]Other reasons for “OutOfMemoryError ”?

I'm getting java.lang.OutOfMemoryError in one of my java application. 我在我的一个Java应用程序中遇到了java.lang.OutOfMemoryError。 I increased size of minimum and maximum heap size under "VM arguments" in eclipse: 我在Eclipse的“ VM参数”下增加了最小和最大堆大小的大小:

-XX:+HeapDumpOnOutOfMemoryError -Xmx8g -Xms2g However, I'm still getting same error. -XX:+ HeapDumpOnOutOfMemoryError -Xmx8g -Xms2g但是,我仍然遇到相同的错误。 In jconsole.exe it displays the following: 在jconsole.exe中,它将显示以下内容: jconsole屏幕截图

If I understood correctly, then I still have plenty of heap memory. 如果我理解正确,那么我仍然有足够的堆内存。

I also analyzed the memory dump using eclipse MAT 我还使用eclipse MAT分析了内存转储 MAT屏幕截图

As you can see, it shows problem but only 9 MB. 如您所见,它显示了问题,但只有9 MB。 So what's exactly the problem? 那么到底是什么问题呢? shouldn't I have enough free heap memory? 我应该没有足够的可用堆内存吗?

Not strictly relating to java but this can also be caused by trying to store something in your memory that can't fit all in one place. 与Java不严格相关,但是这也可能是由于试图在内存中存储无法容纳所有内容的某些内容而引起的。

Consider a car parking lot with metal bars between each parking space. 考虑一个在每个停车位之间都装有金属条的停车场。 There are 20 empty motorcycle spots. 有20个空的摩托车点。 You want to park your SUV. 您想停放SUV。 Even though the total area of the available space is greater than your vehicles requirement you still can't park as it cant fit in any single spot. 即使可用空间的总面积大于您的车辆需求,您仍然无法停放,因为它无法容纳在任何一个地点。

I dont know if this is the case here, but this is the most common reason I run into this problem. 我不知道这是否是这种情况,但这是我遇到此问题的最常见原因。

Are you trying to store something significantly larger than anything else anywhere near where this error happens? 您是否要在此错误发生位置附近存储比其他任何东西都大得多的东西?

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

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