Search code examples
javamemoryjvmjvm-arguments

What does Java start the heap at if I do not specify a -Xms?


Possible Duplicate:
How is the default java heap size determined?

Im curious what happens if I do not specify a -Xms for initial JVM heap size with Java?

Currently I have -Xms256m and -Xmx512m but this gives me an error on my server :

Failed to create JVM, return code is:-1

I believe the JVM is having trouble getting 256MB of contiguous memory with a 256m starting point. Prior to today we only had a -Xmx256m setting but had some processes that were running out of memory.

Can the JVM function if I remove the -Xms setting and just leave the -Xmx512m'? What does the heap start with?

How does it acquire contiguous memory if no starting heap is declared?


Solution

  • To answer your first question. Please look at Ted Hopp's comment. How is the default java heap size determined?

    Secondly you don't need to specify and minimum and a maximum heap size. You are also inputting them incorrectly.

    It should be -Xms256m -Xmx512m

    Initial heap size will be 4Mbyte with a max heap of 64Mbyte on client class machines.