无法为对象堆保留足够的空间来启动JVM [英] Could not reserve enough space for object heap to start JVM

查看:94
本文介绍了无法为对象堆保留足够的空间来启动JVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚遇到奇怪的问题。当我输入

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为128米,我再次得到错误。

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆