java堆空间超出怎么解决,内存不足:Java堆空间,但是在查看堆空间时,它最多使用50 MB...

I'm using ASANT to run a xml file which points to a NARS.jar file. (i do not have the project file of the NARS.jar)

I'm getting "java.lang.OutOfMemoryError: Java heap space.

I used VisualVM to look at the heap while running the NARS.jar, and it says that it max uses 50 MB of the heapspace.

I've set the initial and max size of heapspace to 512 MB.

Does anyone have an ide of what could be wrong?

I got 1 GB physical Memory and created a 5 GB pagefile (for test purpose).

Thanks in advance.

解决方案

Your app may be trying to allocate memory that exceeds your 512m limit, thus you see an outofmemory error even though only 50m is being used. To test this, I would set:

-Xms512m -Xmx1024m

And see what happens. I would also try a smaller test file, say 1g. Keep reducing the file size until you stop seeing the error. If you succeed, then the trouble is that what you're trying to do and the way you're trying to do it takes too much memory. Time to look for an alternate approach.

  • 0
    点赞
  • 0
    收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:深蓝海洋 设计师:CSDN官方博客 返回首页
评论
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值