作为亚马逊ec2的新手,我正在努力使我的申请工作。 我通过SSH连接了几次,我一直在运行和停止服务器,有时连接丢失,还有一些其他的东西…
在某些时候,我从JVM(我的应用程序使用Scala)得到的错误是没有足够的可用内存,并且无法分配它来运行自己。 我所做的是重新启动服务器。 有效。 但我认为应该有更有效的方法。 有没有?
更新 :
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5550000, 715849728, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 715849728 bytes for committing reserved memory. # An error report file with more information is saved as: # /home/ubuntu/my-app/hs_err_pid8668.log
我会看看两个变化:
-Xmx )来匹配你所在的机器。 确保你没有要求比你的虚拟机有更多的内存。 overcommit_memory=2和overcommit_ratio=80 。 用overcommit进入一个不好的地方会导致malloc失败,就像你看到的一样。