First of all, I have a box with 8gb of ram, so I doubt total memory is the issue. This application is running fine on machines with 6gb or less.
首先,我有一个8gb内存的盒子,所以我怀疑总内存不是问题所在。这个应用程序在6gb或以下的机器上运行良好。
I am trying to reserve 3GB of space using -Xmx3G under "VM Arguments" in Run Configurations in Eclipse.
我正在尝试在Eclipse中运行配置的“VM参数”下使用-Xmx3G保留3GB空间。
Every time I try to reserve more than 1500mb, I get this error: “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
每次我尝试保留超过1500mb的内存时,我都会得到这个错误:“VM初始化时发生错误;使用-Xmx3G难道不能为对象堆预留足够的空间吗
What is going on here?
这是怎么回事?
10 个解决方案
#1
53
Could it be that you're using a 32-bit jvm on that machine?
是否您正在那个机器上使用一个32位的jvm ?
#2
37
This is actually not an Eclipse-specific issue; it's a general Java-on-Windows issue. It's because of how the JVM allocates memory on Windows; it insists on allocating a contiguous chunk of memory, which often Windows can't provide, even if there are enough separate chunks to satisfy the allocation request. There are utilities that will try to help Windows "defrag" its memory, which would, in theory, help this situation; but I've not really tried them in earnest so can't speak to their effectiveness. One thing that I've heard sometimes that might help is to reboot Windows and, before starting any other apps, launch the Java app that needs the big chunk of memory. If you're lucky, Windows won't have fragmented its memory space yet and Java will get the contiguous block that is asks for.
这并不是一个特定于日食的问题;这是windows上的一个通用java问题。这是因为JVM如何分配Windows上的内存;它坚持分配一个连续的内存块,这通常是Windows无法提供的,即使有足够的独立块来满足分配请求。有一些实用程序将试图帮助Windows“defrag”它的内存,这在理论上有助于解决这种情况;但我并没有认真地尝试过它们,所以无法证明它们的有效性。我有时听到的一件事可能会有帮助,那就是重新启动Windows,在启动其他应用程序之前,启动需要大量内存的Java应用程序。如果幸运的话,Windows还没有对内存空间进行分段,Java将获得请求的连续块。
Somewhere out on the interwebs there are more technical explanations and analyses of this issue, but I don't have any references handy.
在互联网上的某个地方,有更多关于这个问题的技术解释和分析,但我手头没有任何参考资料。
I did find this, though, which looks helpful: https://*.com/a/497757/639520
不过,我确实发现了这一点,这看起来很有帮助:https://*.com/a/497757/639520
#3
37
Here is how to fix it: Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System
下面是解决方法:启动->控制面板->系统->高级(tab)->环境变量->系统
Variables->New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Variable name: Path
Variable value: ;C:\Program Files\Java\jre6\bin;F:\JDK\bin;
Change this to your appropriate path.
将其更改为合适的路径。
#4
18
First the JRE of 32bits can't use more ~1.5Gb of ram. So if you want more, use a 64bits JRE.
首先,32位的JRE不能使用超过1.5Gb的ram。所以如果你想要更多,使用64位的JRE。
Second, When a new JVM starts, this sum the -Xmx property of the all JVM that are running, and check if there is enough memory left on the system to run at their own -Xmx, if is not enough then the error occurs.
其次,当一个新的JVM启动时,这个sum是所有运行的JVM的-Xmx属性,并检查系统中是否有足够的内存来运行它们自己的-Xmx,如果还不够,则会出现错误。
#5
12
I was using Liferay with Tomcat server from eclipse IDE. I was stuck with this same error on click on server start up. Double click on server from eclipse. it open up Server Overview page. Updated memory arguments from -Xmx1024m -XX:MaxPermSize=256m to -Xmx512m -XX:MaxPermSize=256m. Then it was working for me.
我使用的是来自eclipse IDE的Tomcat服务器的Liferay。在服务器启动时,我遇到了同样的错误。双击eclipse上的服务器。它打开服务器概述页面。从-Xmx1024m -XX更新内存参数:MaxPermSize=256m到-Xmx512m -XX:MaxPermSize=256m。然后它就对我起作用了。
#6
8
Make sure that Eclipse is actually running the same JVM you think it's running. If you use java in your web browser ever, you likely have a 32-bit version floating around too that might be taking precedence if it installed or updated lately.
确保Eclipse实际上正在运行您认为它正在运行的JVM。如果您曾经在web浏览器中使用java,那么您很可能也有一个32位的版本,如果它最近安装或更新,那么这个版本可能也会优先。
To be absolutely sure, I recommend adding these two lines to your eclipse.ini
file at the top:
当然,我建议在eclipse中添加这两行。ini文件顶部:
-vm
C:/Java/jdk1.6.0_27/bin
...where on my machine C:/Java/jdk1.6.0_27/bin
where the JVM I know is 64-bit is located. Be sure to have the bin
folder there.
…在我的机器C:/Java/jdk1.6.0_27/bin中,我知道的JVM是64位的。一定要把bin文件夹放在那里。
(As a bonus, on Windows 7, this also allows you to actually "pin the tab" which is why I had to do this for my own usage)
(作为奖励,在Windows 7上,这也允许你“钉住标签”,这就是为什么我必须这样做的原因)
#7
4
This is the issue of Heap size. Edit your .bat
(Batch file). It might be showing Heap size 1024. Change it to 512 Then it should work.
这是堆大小的问题。编辑您的.bat(批处理文件)。它可能显示堆大小为1024。把它改成512就可以了。
#8
1
I also had the same problem while using Eclipse which was 32 bit and the JVM used by it was 64 bit. When I routed the Eclipse to 32 bit JVM then it worked
我在使用Eclipse时也遇到了同样的问题,Eclipse是32位,JVM使用的是64位。当我将Eclipse路由到32位JVM时,它就工作了
#9
0
Probably you are trying wrong options anyways. I got a similar error with supporting error log:
也许你一直在尝试错误的选择。我得到了支持错误日志的类似错误:
Java HotSpot(TM) Client VM warning: ignoring option PermSize=32M; support was removed in 8.0
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0
Im my case, the software did not support java 8 yet(script was using old JVM arguments) but I had had java 8 by default.
我的情况是,该软件还不支持java 8(脚本使用旧的JVM参数),但我默认使用java 8。
#10
0
One of the reason for this issue is no memory available for Tomcat to start. Try to delete the unwanted running software from windows and restart the eclipse and tomcat.
这个问题的原因之一是Tomcat无法启动内存。尝试从windows删除不想要的正在运行的软件,并重新启动eclipse和tomcat。
#1
53
Could it be that you're using a 32-bit jvm on that machine?
是否您正在那个机器上使用一个32位的jvm ?
#2
37
This is actually not an Eclipse-specific issue; it's a general Java-on-Windows issue. It's because of how the JVM allocates memory on Windows; it insists on allocating a contiguous chunk of memory, which often Windows can't provide, even if there are enough separate chunks to satisfy the allocation request. There are utilities that will try to help Windows "defrag" its memory, which would, in theory, help this situation; but I've not really tried them in earnest so can't speak to their effectiveness. One thing that I've heard sometimes that might help is to reboot Windows and, before starting any other apps, launch the Java app that needs the big chunk of memory. If you're lucky, Windows won't have fragmented its memory space yet and Java will get the contiguous block that is asks for.
这并不是一个特定于日食的问题;这是windows上的一个通用java问题。这是因为JVM如何分配Windows上的内存;它坚持分配一个连续的内存块,这通常是Windows无法提供的,即使有足够的独立块来满足分配请求。有一些实用程序将试图帮助Windows“defrag”它的内存,这在理论上有助于解决这种情况;但我并没有认真地尝试过它们,所以无法证明它们的有效性。我有时听到的一件事可能会有帮助,那就是重新启动Windows,在启动其他应用程序之前,启动需要大量内存的Java应用程序。如果幸运的话,Windows还没有对内存空间进行分段,Java将获得请求的连续块。
Somewhere out on the interwebs there are more technical explanations and analyses of this issue, but I don't have any references handy.
在互联网上的某个地方,有更多关于这个问题的技术解释和分析,但我手头没有任何参考资料。
I did find this, though, which looks helpful: https://*.com/a/497757/639520
不过,我确实发现了这一点,这看起来很有帮助:https://*.com/a/497757/639520
#3
37
Here is how to fix it: Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System
下面是解决方法:启动->控制面板->系统->高级(tab)->环境变量->系统
Variables->New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Variable name: Path
Variable value: ;C:\Program Files\Java\jre6\bin;F:\JDK\bin;
Change this to your appropriate path.
将其更改为合适的路径。
#4
18
First the JRE of 32bits can't use more ~1.5Gb of ram. So if you want more, use a 64bits JRE.
首先,32位的JRE不能使用超过1.5Gb的ram。所以如果你想要更多,使用64位的JRE。
Second, When a new JVM starts, this sum the -Xmx property of the all JVM that are running, and check if there is enough memory left on the system to run at their own -Xmx, if is not enough then the error occurs.
其次,当一个新的JVM启动时,这个sum是所有运行的JVM的-Xmx属性,并检查系统中是否有足够的内存来运行它们自己的-Xmx,如果还不够,则会出现错误。
#5
12
I was using Liferay with Tomcat server from eclipse IDE. I was stuck with this same error on click on server start up. Double click on server from eclipse. it open up Server Overview page. Updated memory arguments from -Xmx1024m -XX:MaxPermSize=256m to -Xmx512m -XX:MaxPermSize=256m. Then it was working for me.
我使用的是来自eclipse IDE的Tomcat服务器的Liferay。在服务器启动时,我遇到了同样的错误。双击eclipse上的服务器。它打开服务器概述页面。从-Xmx1024m -XX更新内存参数:MaxPermSize=256m到-Xmx512m -XX:MaxPermSize=256m。然后它就对我起作用了。
#6
8
Make sure that Eclipse is actually running the same JVM you think it's running. If you use java in your web browser ever, you likely have a 32-bit version floating around too that might be taking precedence if it installed or updated lately.
确保Eclipse实际上正在运行您认为它正在运行的JVM。如果您曾经在web浏览器中使用java,那么您很可能也有一个32位的版本,如果它最近安装或更新,那么这个版本可能也会优先。
To be absolutely sure, I recommend adding these two lines to your eclipse.ini
file at the top:
当然,我建议在eclipse中添加这两行。ini文件顶部:
-vm
C:/Java/jdk1.6.0_27/bin
...where on my machine C:/Java/jdk1.6.0_27/bin
where the JVM I know is 64-bit is located. Be sure to have the bin
folder there.
…在我的机器C:/Java/jdk1.6.0_27/bin中,我知道的JVM是64位的。一定要把bin文件夹放在那里。
(As a bonus, on Windows 7, this also allows you to actually "pin the tab" which is why I had to do this for my own usage)
(作为奖励,在Windows 7上,这也允许你“钉住标签”,这就是为什么我必须这样做的原因)
#7
4
This is the issue of Heap size. Edit your .bat
(Batch file). It might be showing Heap size 1024. Change it to 512 Then it should work.
这是堆大小的问题。编辑您的.bat(批处理文件)。它可能显示堆大小为1024。把它改成512就可以了。
#8
1
I also had the same problem while using Eclipse which was 32 bit and the JVM used by it was 64 bit. When I routed the Eclipse to 32 bit JVM then it worked
我在使用Eclipse时也遇到了同样的问题,Eclipse是32位,JVM使用的是64位。当我将Eclipse路由到32位JVM时,它就工作了
#9
0
Probably you are trying wrong options anyways. I got a similar error with supporting error log:
也许你一直在尝试错误的选择。我得到了支持错误日志的类似错误:
Java HotSpot(TM) Client VM warning: ignoring option PermSize=32M; support was removed in 8.0
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0
Im my case, the software did not support java 8 yet(script was using old JVM arguments) but I had had java 8 by default.
我的情况是,该软件还不支持java 8(脚本使用旧的JVM参数),但我默认使用java 8。
#10
0
One of the reason for this issue is no memory available for Tomcat to start. Try to delete the unwanted running software from windows and restart the eclipse and tomcat.
这个问题的原因之一是Tomcat无法启动内存。尝试从windows删除不想要的正在运行的软件,并重新启动eclipse和tomcat。