每次我试图运行该程序时,都会重复得到以下异常。

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

我试图增加我的虚拟内存(页面大小)和RAM大小,但没有效果。

我怎样才能消除这个错误?


当前回答

使用-XX:MaxHeapSize=512m(或任何您需要的大数字)(或-Xmx512m简称)运行JVM

其他回答

使用-XX:MaxHeapSize=512m(或任何您需要的大数字)(或-Xmx512m简称)运行JVM

我有适量的内存设置,但对我来说,它是使用64位intellij和32位jvm。一旦我切换到64位虚拟机,错误就消失了。

假设您有足够的空闲内存,并且正确地设置了JVM参数,那么您可能会遇到内存碎片的问题。在Windows XP上检查Java最大内存。

错误:

对于“初始化vm时发生错误,无法为对象堆jboss预留足够的空间”的错误。

根本原因:

JVM内存分配不当/不足,如下所述。 例如,jboss-eap-6.2\bin\standalone.conf中的JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MaxPermSize=256m"或jboss-eap-6.2\bin\standalone.conf.bat中的"JAVA_OPTS=-Xms1G -Xmx1G -XX:MaxPermSize=256m",这只是JVM内存分配池参数。

解决方法:

Increase the heap size. To increase the heap size, goto -> jboss-eap-6.2\bin\standalone.conf.bat or jboss-eap-6.2\bin\standalone.conf change ->JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=256m" where -Xms is Minimum heap size and -Xmx is Maximum heap size. Usually its not recommanded to have same size for min and max. If you are running your application from eclipse, Double click on the server select 'open launch configuration' you will be redirected to the window 'Edit launch configuration properties'. In this windown goto the tab '(x)=Arguments'. In VM Arguments, define your heap size as mentioned below "-Dprogram.name=JBossTools: JBoss EAP 6.1+ Runtime Server" -server -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true

我也有类似的问题。我在一台64位机器上安装了32位版本的Java。

通过卸载该版本并安装64位版本的Java。我解决了这个问题。