Linux 虚拟机初始化时出错;无法为对象堆保留足够的空间;无法创建Java虚拟机

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7350486/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:05:21  来源:igfitidea点击:

Error occurred during initialization of VM; Could not reserve enough space for object heap; Could not create the Java virtual machine

javalinux

提问by user454083

I got this java problem

我有这个java问题

[root@peach sbin]# java
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
[root@peach sbin]# free -m
             total       used       free     shared    buffers     cached
Mem:           256        182         73          0          0          0
-/+ buffers/cache:        182         73
Swap:            0          0          0
[root@peach sbin]# 

This is a virtual machine. I am thinking this problem because of the memory is not big enough. If some one agree with me.

这是一个虚拟机。我在想这个问题是因为内存不够大。如果有人同意我的看法。

It is running with a CentOS release 5.6 (Final)

它运行 CentOS 5.6 版(最终版)

Thanks

谢谢

回答by Arthur

Try

尝试

java -Xmx64m

Basically your machine doesn't have enough memory, but you may be able to get away with 64MB. Let me know how you get on.

基本上你的机器没有足够的内存,但你可能能够逃脱 64MB。让我知道你是怎么办的。

回答by Juan Esteban Katz Delgado

You can use this command to know your current memory usage:

您可以使用此命令来了解您当前的内存使用情况:

swapinfo -tam

I had the same error and the memory use was above 95%.

我有同样的错误,内存使用率高于 95%。