[JVM] How to know about JVM defaults settings and supported flags

Each JVM implementation had a different set of default and choose default settings based on the environment it runs in. It’s always good to know the default. Let’s see how to get the default.

Using -XX:+PrintCommandLineFlags

bash-3.2$ java -XX:+PrintCommandLineFlags
-XX:InitialHeapSize=67108864 -XX:MaxHeapSize=1073741824 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC

This is the output on my laptop. The JVM choose Compressed Oops and parallel GC. PrinCommandLineFlags provides a compact out.

Viewing all JVM supported flags

To view all the flags and their values supported by a JVM, use -XX:+PrintFlagsFinal

It displays a long list of all the flags. Here is the output for JDK 1.8 running locally


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.