Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

“Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G

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?

like image 629
user1212731 Avatar asked Feb 16 '12 00:02

user1212731


People also ask

How do you resolve Error occurred during initialization of VM Could not reserve enough space for object heap?

To fix the error "Could not reserve enough space for object heap", add the options "-Xmx<size>m" to set the maximum size for the object heap memory allocation. This must be set large enough to accommodate loading your application into memory, but smaller than your requested total memory allocation by 2GB.

How do I fix a heap space error?

The java. lang. OutOfMemoryError: Java heap space error occurs when it attempts to add more data into the heap space area, but there is not enough room for it. The solution to fix this problem is to increase the heap space(Default value maybe 128 MB).

What is the max heap size for 64 bit JVM?

For 64 bit platforms and Java stacks in general, the recommended Maximum Heap range for WebSphere Application Server, would be between (4096M - 8192M) or (4G - 8G).


2 Answers

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

like image 161
Laurent Avatar answered Sep 28 '22 02:09

Laurent


Here is how to fix it: Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System

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.

like image 34
Mohamed Adel Avatar answered Sep 28 '22 01:09

Mohamed Adel