Jun 212012
Java Errors


If you are getting below error message while using installed Java then please follow below given steps to resolve the issue.


Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

1. Check whether -Xmx has been set explicitly or not for 32 bit or 64 bit JVM

If you don’t specify -Xmx explicitly, the default selection for the max heap size could be implicitly set by the Ergonomics feature that was added in JDK 5.

See this for more info on the feature http://www.oracle.com/technetwork/java/ergo5-140223.html

The Ergonomics algorithm does not take the memory into account that is available on the system during startup. If a system has 6 GB of memory and ergonomics selects a default of 2 GB for the max Java heap size, the JVM could fail during initialization if the 2 GB cannot be reserved.

Specify -Xmx explicitly. Make sure that there is enough memory available on the system for the value that you specify for the max Java heap.

java -Xmx128m -version

If you use JDK 6 you can also set the ErgoHeapSizeLimit JVM option – the maximum ergonomically set heap size (in bytes):


java -XX:ErgoHeapSizeLimit=128m -version

2. Check whether the value for -Xmx has been set too large (32 bit JVM only)

32 bit architectures limit the amount of memory any single process can allocate to 4 GB (theoretical address space is 2^32 bytes). However, there is memory overhead that the JVM and the Operating System use for a Java process. A Java process space consists of the Java heap, the Java permanent generation, the native heap, the threads, mapped files, loaded shared libraries and so on. If you run a 32 bit JVM, the maximum value for the java heap (-Xmx) of a Java process is much smaller than 4 GB actually.

There is also a limitation of the Windows 32 bit Operating System. Windows 32 bit processes can only use a max of 2 GB memory address space. Although Windows does allow a process size > 2 GB through its “Physical Address Extension (PAE)”, the HotSpot JVM currently does not use this feature.

Decrease the Java Heap Space value (-Xmx) to a reasonable value that takes all the other memory usage for the process into account or move to a 64 bit architecture (64 bit machine, 64 bit Operating System and a 64 bit JRE).

3. Check whether the system is low on virtual memory (32 bit or 64 bit JVM)

On Solaris you can use the swap command in order to determine whether you have enough virtual memory available:

$ /usr/sbin/swap -s

Decrease the -Xmx value, don’t run too many heavy processes on the system, and/or configure more swap.

4. Check Limitations on the System Resources in the current shell

On both Linux and Solaris the stack size is controlled by setting limitations on the system resources available to the current shell and its descendants.

On Windows platforms, the stack size information is contained in the executable file.

5. Check if the Virtual Memory Limit is set too small


$ ulimit -v

Check if the stack size is set to unlimited (Solaris SPARC only)


$ ulimit -s

Check below url for memory limits of windows server

© Incase of any copyright infringements please check copyrights page for faster resolutions.

Leave a Reply

Show Buttons
Hide Buttons