tomcatjvmheap-memorycatalina

Tomcat not starting : Not able to reserve enough space for object heap


When starting tomcat I get the error

Not able to reserve enough space for Object Heap

Not able to create Java virtual machine

I googled a bit and it seems that this is a common problem but the fix which was mentioned everywhere does not work for me.

Every place where this problem was mentioned said "set CATALINA_HOME or JAVA_OPTS." I set the values for both the variables and reserved enough space for head and permsize but still I am facing the same issue.

On a lighter node: I have verified that there is enough space available for allocation.

I am using 32 bit stack and I am setting following values for JAVA_OPTS and CATALINA_OPTS

-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m


Solution

  • Java on 32bit Windows requires a contiguous block of memory - windows32 cannot give too big a block of memory, AFAIK max 1.5G (this is memory back from the XP times), but only that much if the memory is not too fragmented already (yes, I know, sounds weird nowadays).

    So, you might try to reboot your machine and start java/tomcat first thing, before you start other applications. Another option is to provide less memory (try how much is required vs. available).

    Also, for production settings, I always recommend to have -Xms and -Xmx to have the same size: If something goes wrong, you'll get the result immediately, plus the contiguous block of memory has been allocated already.