Java – the default maximum heap size for Sun’s JVM from Java SE 6

javajvmmemory-management

What is the default maximum heap size for Sun's JVM from Java SE 6 (i.e. equivalent to setting -Xmx)?

Looks like for Java SE 5 with a server-class machine, it's

Smaller of 1/4th of the physical memory or 1GB.

Bonus question: Looks like for IBM's JVM you can ask it

java -verbose:sizes -version

Can you similarly ask Sun's JVM?

Edit:

I used Runtime.getRuntime().maxMemory to confirm min(physical memory/4, 1G), referenced in Sun documentation.

Best Answer

java 1.6.0_21 or later, or so...

$ java -XX:+PrintFlagsFinal -version 2>&1 | grep MaxHeapSize
uintx MaxHeapSize                         := 12660904960      {product}

It looks like the min(1G) has been removed.

Or on Windows using findstr

C:\>java -XX:+PrintFlagsFinal -version 2>&1 | findstr MaxHeapSize