Search code examples
jvmjvm-arguments

Default values for Xmx, Xms, MaxPermSize on non-server-class machines


What are the default values for the following options in Java 6 on a non-server-class machine?

  • -Xmx
  • -XX:MaxPermSize

Oracle's documentation states that:

On server-class machines running the server VM, the garbage collector (GC) has changed from the previous serial collector (-XX:+UseSerialGC) to a parallel collector (-XX:+UseParallelGC).

and

On server-class machines running either VM (client or server) with the parallel garbage collector (-XX:+UseParallelGC) the initial heap size and maximum heap size have changed

The page doesn't describe the defaults for non-server-class machines, only that, for example, the initial heap size is "a reasonable minimum". Looking at the 'man page' for the java command there is the following against -Xms:

The default value is chosen at runtime based on system configuration


Solution

  • Default values for JDK 1.6.0_29 on Windows 7/32-bit:

    -Xmx256m
    -XX:MaxPermSize=64m
    

    Also value of these option can be printed by following command:

    java -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version 2>&1
    

    Then look for MaxHeapSize and MaxPermSize keys and see default values.

    uintx InitialHeapSize                          := 199947456       {product}
    uintx MaxHeapSize                              := 268435456       {product}           
    uintx MaxPermSize                               = 67108864        {pd product}        
    

    Here is the Ultimate HotSpot VM Options Cheat Sheet with defaults and descriptions for last 5 versions of JDK (7, 8, 9, 10 & 11).