java 如何解决此问题:“VM 初始化期间发生错误;无法为对象堆保留足够的空间”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4775716/
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
How to resolve this : "Error occurred during initialization of VM; Could not reserve enough space for object heap"
提问by Rajat Gupta
I am trying to start my database server from command prompt in Windows. But I receive the following error:
我正在尝试从 Windows 中的命令提示符启动我的数据库服务器。但我收到以下错误:
Error occurred during initialization of VM
Could not reserve enough space for object heap
虚拟机初始化时出错
无法为对象堆保留足够的空间
However the attempt is successful if I log off and log on again or restart. I think it is because of insufficient RAM in my computer (1GB).
但是,如果我注销并再次登录或重新启动,则尝试成功。我认为这是因为我的电脑内存不足(1GB)。
How can I resolve this issue?
我该如何解决这个问题?
Please retag if I have tagged it wrong. Thanks!
如果我标记错误,请重新标记。谢谢!
回答by Bozho
Try changing the memory settings of the VM. see herehow to pass this as command-line arguments. For example
尝试更改 VM 的内存设置。请参阅此处如何将其作为命令行参数传递。例如
java -Xmx512m -Xms256m ....
If, however, your machines does not have enough RAM to handle this, the only resolution is to buy more RAM. It might still be possible to make it run with tweaking the above settings - I once spent half an hour trying to run an application with a limited amount of RAM by experimenting with different values for Xmx
and MaxPermSize
.
但是,如果您的机器没有足够的内存来处理这个问题,唯一的解决办法就是购买更多的内存。它可能仍然是可能的,使其运行与调整上面的设置-我曾经花了一个半小时试图通过与不同的值进行试验运行的RAM数量有限的应用程序Xmx
和MaxPermSize
。
回答by Haris Durrani
I got the same error and resolved it by changing values in grade settings file of project
我遇到了同样的错误并通过更改项目等级设置文件中的值来解决它
org.gradle.jvmargs=-Xmx1536m to org.gradle.jvmargs=-Xmx512m
org.gradle.jvmargs=-Xmx1536m 到 org.gradle.jvmargs=-Xmx512m
回答by Tom Rees
Try giving the JVM an extra argument:
尝试给 JVM 一个额外的参数:
-mX256M
Despite the gigabyte of RAM in your machine, Java is only given a small chunk (64mb?) to play with. This argument allocates even more memory to the process.
尽管您的机器中有 GB 的 RAM,但 Java 只提供了一小块(64mb?)可以使用。此参数为进程分配更多内存。