java 虚拟机初始化期间发生错误无法为对象堆保留足够的空间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14450985/
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
Error occurred during initialization of VM Could not reserve enough space for object heap
提问by venus.w
I have virtual machine with 3Giga Ram Memory. I am working with Java protocol on Loadrunner. I am trying to set the addtional VM Params to be more than 256M but always getting this error. I tried :-Xms512 -Xmx512 without success. Please response ASAP - i am stuck with that issue for the last 2 days .
我有 3Giga Ram 内存的虚拟机。我正在 Loadrunner 上使用 Java 协议。我正在尝试将附加 VM 参数设置为超过 256M,但总是出现此错误。我试过 :-Xms512 -Xmx512 没有成功。请尽快回复 - 我在过去 2 天一直被这个问题困扰。
Thanks.. (I am working with jdk 1.6.0 and once try run the flow i have free memory of 2000MB)
谢谢..(我正在使用 jdk 1.6.0,一旦尝试运行流程,我就有 2000MB 的可用内存)
Notify: Found jdk version: 1.6.0. Notify: classpath=D:\seamlessServerPerfTest\SSCallAV\;c:\program files\hp\loadrunner\classes\srv;c:\program files\hp\loadrunner\classes;D:\seamlessServerPerfTest\lib\SSCallAV_8leg.jar;D:\seamlessServerPerfTest\lib\json-lib-2.4-jdk15.jar;D:\seamlessServerPerfTest\lib\todejolt.jar;D:\seamlessServerPerfTest\lib\protobuf-java-2.4.1.jar;D:\jython2.5.2\Lib\site-packages\trilead-ssh2-build213.jar;D:\jython2.5.2\Lib\site-packages\asimessagehandler.jar;D:\jython2.5.2\Lib\site-packages\dblibrary-1.0.jar;D:\jython2.5.2\Lib\site-packages\jolt.jar;D:\jython2.5.2\Lib\site-packages\ojdbc14.jar;D:\postgreSql\postgresql-9.1-901.jdbc4.jar;;; Notify: Path=C:\Program Files\Java\jdk1.6.0_12\jre\bin\client;C:\PROGRA~1\HP\LOADRU~1\bin;C:\PROGRA~1\HP\LOADRU~1\bin\tulip\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Python27;C:\Program Files\Java\jdk1.6.0_12\bin;D:\Python27\Scripts;D:\jython2.5.2\Lib\site-packages\dblibrary-1.0.jar;D:\jython2.5.2\Lib\site-packages\jolt.jar;D:\jython2.5.2\Lib\site-packages\ojdbc14.jar;D:\postgreSql\postgresql-9.1-901.jdbc4.jar;D:\jython2.5.2;D:\Python27\Lib\site-packages;D:\Python27\Lib\site-packages\robot\libraries;d:\IEDriverServer.exe;d:\jython2.5.2\bin;D:\jython2.5.2\Lib\site-packages;; Notify: VM Params: -Xms512m -Xmx512m. Notify: Error occurred during initialization of VM Notify: Could not reserve enough space for object heap
通知:发现 jdk 版本:1.6.0。通知:classpath=D:\seamlessServerPerfTest\SSCallAV\;c:\program files\hp\loadrunner\classes\srv;c:\program files\hp\loadrunner\classes;D:\seamlessServerPerfTest\lib\SSCallAV_8leg.jar;D :\seamlessServerPerfTest\lib\json-lib-2.4-jdk15.jar;D:\seamlessServerPerfTest\lib\todejolt.jar;D:\seamlessServerPerfTest\lib\protobuf-java-2.4.1.jar;D:\jython2.5.2 \Lib\site-packages\trilead-ssh2-build213.jar;D:\jython2.5.2\Lib\site-packages\asimessagehandler.jar;D:\jython2.5.2\Lib\site-packages\dblibrary-1.0.jar ;D:\jython2.5.2\Lib\site-packages\jolt.jar;D:\jython2.5.2\Lib\site-packages\ojdbc14.jar;D:\postgreSql\postgresql-9.1-901.jdbc4.jar; ;; 通知:Path=C:\Program Files\Java\jdk1.6.0_12\jre\bin\client;C:\PROGRA~1\HP\LOADRU~1\bin;C:\PROGRA~1\HP\LOADRU~1 \bin\tulip\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D: 通知:VM 参数:-Xms512m -Xmx512m。通知:VM 初始化期间出错通知:无法为对象堆保留足够的空间
回答by mreaper
This really could be the case. The JVM might really not be able to reserve the required memory.
这真的可能是这种情况。JVM 可能真的无法保留所需的内存。
You can try the below if it works
如果有效,您可以尝试以下方法
First, run java -XX:MaxHeapSize=512m Test1
. Then run java -Xms512m - Xmx512m Test1
首先,运行java -XX:MaxHeapSize=512m Test1
。然后运行java -Xms512m - Xmx512m Test1
回答by James Pulley
So, just for clarity...you are engaging in double virtualization. You have a JAVA Virtual machine on top of an OS virtual machine so any call for resources has to thunk through two layers of arbitration before it gets to a physical resource like RAM or CPU, right?
所以,为了清楚起见……您正在进行双重虚拟化。您在 OS 虚拟机之上有一个 JAVA 虚拟机,因此任何对资源的调用都必须通过两层仲裁才能到达物理资源(如 RAM 或 CPU),对吗?
So, have you tried this on a host with only a single layer of arbitration, such as Windows workstation ( for less than 2GB allotments) or Windows server instance (for greater than 2GB allotments) not running inside of a virtual machine? I am trying to remove complexity and moving parts to get to the simplest model which demonstrates the error to elinate the possibility that one of the complexities is the cause.
那么,您是否在仅具有单层仲裁的主机上尝试过此操作,例如不在虚拟机内部运行的 Windows 工作站(用于小于 2GB 的分配)或 Windows 服务器实例(用于大于 2GB 的分配)?我试图消除复杂性和移动部分以获得最简单的模型,该模型证明了消除其中一种复杂性是原因的可能性的错误。
If you could share some of the end goal this might be helpful as well. Are you experiencing errors related to memory on your virtual users which are driving you to mod the default parameters for the JAVA virtual user machine execution?
如果您可以分享一些最终目标,这也可能会有所帮助。您是否遇到与虚拟用户内存相关的错误,这些错误促使您修改 JAVA 虚拟用户机器执行的默认参数?
回答by MoonNG
Venus
金星
May i know if you start record with option "Executable\Batch" ? If yes, try to remove assign heap command "-Xms512m -Xmx512m" from the batch file and record. hope it helps.
我可以知道您是否使用“Executable\Batch”选项开始记录?如果是,请尝试从批处理文件中删除分配堆命令“-Xms512m -Xmx512m”并记录。希望能帮助到你。
回答by Tin
Your jvm virtual machine ask too much memory in your computer, you could check out wheather your computer memory is enough.
你的jvm虚拟机对你的电脑内存要求过高,你可以检查一下你的电脑内存是否足够。
Solution:In gradle.properties file, change org.gradle.jvmargs=-Xmx2048m
into
org.gradle.jvmargs=-Xmx1024m
or less.
解决方法:在gradle.properties文件中,org.gradle.jvmargs=-Xmx2048m
改成
org.gradle.jvmargs=-Xmx1024m
或更少。