Take the 2-minute tour ×

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.

I am trying to reserve 3GB of space using -Xmx3G under "VM Arguments" in Run Configurations in Eclipse.

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

What is going on here?

share|improve this question
What version of java do you have? What operating system are you running on? –  Adam Rofer Feb 16 '12 at 2:07
This was Win7, and I had 3 different Java versions installed. One of those was the 32-bit JRE that Eclipse was using. –  user1212731 Feb 16 '12 at 19:32
Don't forget to mark an answer as correct. –  xdhmoore Mar 20 '13 at 21:10

7 Answers 7

Could it be that you're using a 32-bit jvm on that machine?

share|improve this answer
Sorry for the stupid question, but how would I check that? And how can I use 64-bit? –  user1212731 Feb 16 '12 at 0:48
Actually, I just tried java -d64 -version in the command line, and it came up with 64-bit server VM. –  user1212731 Feb 16 '12 at 0:51
Apparently Eclipse was using the 32-bit version of JRE that I had installed previously, even though the 64-bit was the latest installation. I changed the settings in Preferences --> Installed JREs to solve this issue. Thank you very much for your answer! –  user1212731 Feb 16 '12 at 19:28
for my case yes this was the issue –  Vik Nov 22 '12 at 2:21
It should be, but this solves my problem. No upvote for this answer because of the lack of explanation. This link explains how a 32bit jvm can't go over 1gb max heap space –  Steven Nov 20 '13 at 9:54

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.

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: http://stackoverflow.com/a/497757/639520

share|improve this answer

First the JRE of 32bits can't use more ~1.5Gb of ram. So if you want more, use a 64bits 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.

share|improve this answer

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.

To be absolutely sure, I recommend adding these two lines to your eclipse.ini file at the top:


...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.

(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)

share|improve this answer
The -vm argument should point to the Java executable, not just a folder. See wiki.eclipse.org/%C2%A0eclipse.ini#Specifying_the_JVM –  E-Riz Feb 16 '12 at 15:03
Wrong. See this Eclipse bug: bugs.eclipse.org/bugs/show_bug.cgi?id=314805 –  Adam Rofer Feb 16 '12 at 16:18
This was indeed the issue! Eclipse was using the 32-bit version of JRE that I had installed at some point. Thank you very much for the answer and leading me in the right direction! I very much appreciate it. –  user1212731 Feb 16 '12 at 19:25
@AdamRofer, that bug is interesting, but specifically about Windows 7 and to work around a problem with pinning Eclipse to the taskbar. In general, eclipse.ini should point to the java executable, although the Equinox launcher seems to be intelligent in that it will look for a java executable if -vm points to a folder (on Windows, at least). –  E-Riz Feb 16 '12 at 20:12
@E-Riz "should" is too strict for my taste :) Hopefully they resolve the bug without having to change the vm argument sometime. Here's more information that would be be good for them to update on their eclipse.ini page: wiki.eclipse.org/… –  Adam Rofer Feb 16 '12 at 20:41

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

Your Answer


