问题描述
刚刚遇到奇怪的问题.当我输入时
Just faced with strange issue. When i type
java -version
我明白了
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
.
java -Xms64m -Xmx64m -version
这个命令很好用
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode)
如果我将 xms、xmx 更改为 128m,我会再次出错.
If i change xms, xmx to 128m, i get error again.
使用 top
命令和 free -m
我可以看到,我获得了超过 192 mb 的空闲空间,那么为什么我仍然会收到此错误?
Using top
command and free -m
i can see, that i got over 192 mb free, so why i still get this error ?
Mem: 262144k total, 64760k used, 197384k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
谢谢
推荐答案
您尝试运行它的机器似乎只有 256 MB 内存.
It looks like the machine you're trying to run this on has only 256 MB memory.
也许 JVM 尝试分配一个大的、连续的 64 MB 内存块.您可用的 192 MB 可能会被分割成更小的部分,因此没有 64 MB 的连续块可供分配.
Maybe the JVM tries to allocate a large, contiguous block of 64 MB memory. The 192 MB that you have free might be fragmented into smaller pieces, so that there is no contiguous block of 64 MB free to allocate.
尝试使用较小的堆大小启动 Java 程序,例如:
Try starting your Java program with a smaller heap size, for example:
java -Xms16m ...
这篇关于无法为对象堆保留足够的空间来启动 JVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!