简体   繁体   English

java堆大小增加和内存不足

[英]java heap size increasing and out of memory

I use java visual VM to monitor my heap and i see that the heap dump is showing bad signs我使用 java visual VM 来监控我的堆,我看到堆转储显示出不好的迹象在此处输入图片说明

I think that this is why I am running out of memory,我认为这就是我内存不足的原因,

How to limit the "size" (orange area) ?如何限制“大小”(橙色区域)?

Since your used heap size is stable, you can limit maximum heap size by using -Xmx512m to limit it to 512 MB for example.由于您使用的堆大小是稳定的,您可以通过使用 -Xmx512m 来限制最大堆大小,例如将其限制为 512 MB。

This is a good article on what proper sizing should be (a bit out of date though): http://publib.boulder.ibm.com/infocenter/javasdk/tools/index.jsp?topic=%2Fcom.ibm.java.doc.igaa%2F_1vg00014884d287-11c3fb28dae-7ff6_1001.html这是一篇关于适当大小应该是什么的好文章(虽然有点过时): http : //publib.boulder.ibm.com/infocenter/javasdk/tools/index.jsp?topic=%2Fcom.ibm.java .doc.igaa%2F_1vg00014884d287-11c3fb28dae-7ff6_1001.html

Edit: Since I see youre using NetBeans profiler, to set the option, just right click your project > Properties > Run > VM Options: -Xmx512m编辑:因为我看到你在使用 NetBeans 分析器,要设置该选项,只需右键单击你的项目 > 属性 > 运行 > VM 选项:-Xmx512m

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

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