Java 应用程序运行时出现“无法分配内存”(errno=12) 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20687517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'Cannot allocate memory' (errno=12)' errors during runtime of Java application
提问by Bj?rn Jacobs
While running a distributed application, I get a lot of these errors on the server as well as on the worker nodes:
在运行分布式应用程序时,我在服务器和工作节点上遇到了很多这样的错误:
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f4f8c800000, 549453824, 2097152, 0) failed; error='Cannot allocate memory' (errno=12)
Most of the time the process continues and finishes as expected but sometimes the process also fails.
大多数情况下,该过程会继续并按预期完成,但有时该过程也会失败。
I am calling my application with java -Xms512M -Xmx50G -cp myjar.jar myclass.Main
我正在调用我的应用程序 java -Xms512M -Xmx50G -cp myjar.jar myclass.Main
The nodes have 128 GBs of RAM where about 120 GBs are free.
节点有 128 GB 的 RAM,其中大约 120 GB 是空闲的。
I'm using the Oracle JVM:
我正在使用 Oracle JVM:
$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
What do these messages mean and how can I get rid of them?
这些消息是什么意思,我该如何摆脱它们?
采纳答案by Bj?rn Jacobs
As Platypus suggested in the comments to my question, I downgraded Java to version 1.7.0_41. Unfortunately the problem persisted.
正如鸭嘴兽在对我的问题的评论中所建议的那样,我将 Java 降级到 1.7.0_41 版。不幸的是,问题仍然存在。
I went even farther back to version 1.7.0_25 and apparently this solvedthe error. I tried it many times and the error message didn't occur a single more time.
我更进一步回到 1.7.0_25 版本,显然这解决了错误。我试了很多次,错误信息没有再出现一次。