Java VM Initialization error: could not reserve Space For Object Heap

The blog discusses the Java VM Initialization error while running the Weblogic Server. 

Error occurred during initialization of VM
Could not reserve enough space for object heap

The error is an JVM error and encountered when the Java Process cannot create the Virtual machine at run time due to limitations on the Heap Size for memory allocations.  Heap Size is the memory allocation for storing java object at run time. The Heap Size values can be managed though Xmx and Xms VM arguments. 

The below could be the reason for object heap error

  1. The  heap size is not defined to be allocated for the memory
  2. Installed 32 bit JVM in 64 bit machine
  3. The provided heap size -Xmx value is defined too high than to be allocated as per 32- bit VM.
  4. The provided heap size -Xmx value is defined too less than to be allocated as per 32- bit VM.
  5. The provided heap size -Xmx value more than the available physical memory. 

The heap size values will differ based on below configurations

  1. Operating system 32-bit machine or 64-bit machine.
  2. JVM 32/64 bit version
  3. hardware architecture

Identify the Current Heap Size 

In case of Weblogic Server, the server start provides the Java Memory arguments for heap size 

Java VM Initialization error

Modify the Java Heap Size memory arguments

Update the Java memory arguments by performing the below action

Linux: 

 -bash-3.2$ export _JAVA_MEMORY_OPTIONS =”-Xmx512M”

Windows: 

Update the Windows Environment Variables

Increase Java Heap Size

Updating Heap Size for Weblogic Server running SOA

In case the above error is coming while running weblogic server or the managed server like soa_server1 , then you can update the Heap Size Memory allocation in the Environment variable using USER_MEM_ARGS which overrides the value for MEM_ARGS in the setDomainEnv.cmd file of the weblogic domain.

weblogic User Memory arguments

Updating Heap Size from Weblogic Server Console

Perform the below given steps:

  1. Log into the weblogic server console
  2. Click on Servers
  3. Select the Server for which changes need to be done.  (AdminServer) 
  4. Click on Monitoring -> Performance Tab
  5.  Update the Heap Size values.

Weblogic console heap size allocation

Restart the Weblogic Server and memory issue should be resolved now.