How to know what values, flags, paramters are set to Java VM options by default
Environment
- Java
Issue
- How do I know what values/flags are set to Java VM options by default?
- I would like to know the default value of the following options:
-XX:PermSize
-XX:MaxPermSize
-XX:NewRatio
-XX:SurvivorRatio
-XX:MaxTenuringThreshold
Resolution
You can see a list of JVM options and its default value from Content from www.oracle.com is not included.Content from www.oracle.com is not included.http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
Please note that some of the default values may vary due to JVM GC ergonomics tweaking or platform dependent, etc. You can utilize the following Java VM options to understand what value is tweaked:
-
-XX:+PrintFlagsInitial
This will print all the default value of the flags before JVM processes the passed values in flags or does its own ergonomics tweaking. -
-XX:+PrintFlagsFinal
This will print all the value of the flags after JVM is done with processing/teaking. -
-XX:+PrintCommandLineFlags
This will print the flags passed on command line or set by JVM GC ergonomics.
You can use the above Java VM option -XX:+PrintFlagsFinal to check what flag is enabled and value is set in the JVM you are running. Here's example output:
$ java -XX:+PrintFlagsFinal -version | egrep '( PermSize| MaxPermSize| NewRatio| SurvivorRatio| MaxTenuringThreshold)'
uintx MaxPermSize = 174063616 {pd product}
intx MaxTenuringThreshold = 15 {product}
intx NewRatio = 2 {product}
uintx PermSize = 21757952 {pd product}
intx SurvivorRatio = 8 {product}
java version "1.6.0_28"
OpenJDK Runtime Environment (IcedTea6 1.13.0pre) (rhel-1.66.1.13.0.el6-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
$ java -XX:+PrintFlagsFinal ...(other jvm options)...
[Global flags]
...
bool HeapDumpOnOutOfMemoryError = false {manageable}
ccstr HeapDumpPath = {manageable}
...
uintx InitialHeapSize := 61596736 {product}
...
uintx MaxHeapSize := 985661440 {product}
uintx MaxPermSize = 174063616 {pd product}
...
intx NewRatio = 2 {product}
uintx NewSize = 1310720 {product}
...
uintx PermSize = 21757952 {pd product}
...
bool PrintFlagsFinal := true {product}
bool PrintFlagsInitial = false {product}
bool PrintGC = false {manageable}
bool PrintGCApplicationConcurrentTime = false {product}
bool PrintGCApplicationStoppedTime = false {product}
bool PrintGCDateStamps = false {manageable}
bool PrintGCDetails = false {manageable}
bool PrintGCTaskTimeStamps = false {product}
bool PrintGCTimeStamps = false {manageable}
bool PrintHeapAtGC = false {product rw}
...
intx SurvivorRatio = 8 {product}
...
bool UseCompressedOops := true {lp64_product}
...
bool UseLargePages = false {pd product}
bool UseLargePagesIndividualAllocation = false {pd product}
...
bool UseParNewGC = false {product}
bool UseParallelGC := true {product}
bool UseParallelOldGC = true {product}
Each table row represents an XX flag and contains five columns:
- 1st column: the data types of this flag
- 2nd column: the name of this flag
- 3rd column:
"="means that the value in the 4th column is the default value for the flag, and":="means that the flag was modified to that value (either by the user setting or by Java VM GC ergonomics) - 4th column: the value of this flag
- 5th column: categories where a given flag applies
The categories are compound identifiers that describe the scenarios where a given flag applies. See also Content from hg.openjdk.java.net is not included.OpenJDK source code for details. For example:
product: An officially supported, internal JVM optionrw: Dynamically writableC1: Client JIT CompilerC2: Server JIT Compilerpd: Platform Dependentlp64_product: 64bit VM only. (A flag is always constant in 32 bit VM.)manageable: Dynamically writeable through the JDK management interface (com.sun.management.HotSpotDiagnosticMXBeanAPI) and also through JConsolediagnostic: VM debugging (used for VM quality assurance or diagnosis of VM bugs along with-XX:+UnlockDiagnosticVMOptionsoption)experimental: Not officially supported experimental JVM options
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.