JVM arguments master sheet

This is a master sheet with most of the JVM arguments:

JVM ArgumentDescription
-XbatchDisables background compilation so that compilation of all methods proceeds as a foreground task until completed. To learn more click here.
-Xbootclasspath:<paths>
Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) in Unix and semicolons (;) in Windows to search for boot class files. These are used in place of the boot class files included in the JDK.To learn more click here
-Xbootclasspath/a:<paths>Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) in Unix and semicolons (;) in Windows to append to the end of the default bootstrap class path.To learn more click here
-Xbootclasspath/p:<paths>Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) in Unix and semicolons (;) in Windows to prepend to the front of the default bootstrap class path.To learn more click here
-Xcheck:jniWhen used validates the parameters passed to the JNI function and the runtime environment data before processing the JNI request.To learn more click here
-XcompForces compilation of methods on first invocation. It disables interpreted method invocations to increase compilation performance at the expense of efficiency.To learn more click here
-XdebugDoes nothing. Provided for backward compatibility for Java versions prior to Java 1.6 where it was used to turn on remote debugging using the Java Virtual Machine Debug Interface (JVMDI).To learn more click here
-XdockOnly available for MacOS to set the name and the icon of the app on displayed in the Dock using –Xdock:name=<name> and -Xdock:icon=<path>.To learn more click here
XfutureEnables strict class-file format checks that enforce close conformance to the class-file format specification. The use of this flag is encouraged when developing new code in anticipation of these checks becoming the default in a future release.To learn more click here
-XintRuns the application in interpreted-only mode. Compilation to native code is disabled, and all bytecode is executed by the interpreter. The performance benefits offered by the just in time (JIT) compiler are not present in this mode.To learn more click here
-XmixedExecutes all bytecode by the interpreter except for hot (repeatedly called) methods, which are compiled to native code.To learn more click here
-XmnNNNSets the initial and maximum size (in bytes) of the heap for the young generation (nursery). Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XmsNNNSets the minimum and the initial size (in bytes) of the heap. This value must be a multiple of 1024 and greater than 1 MB. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XmxNNNSpecifies the maximum size (in bytes) of the memory allocation pool in bytes. This value must be a multiple of 1024 and greater than 2 MB. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes. To learn more, click here
-XnoclassgcDisables garbage collection (GC) of classes.  When used at startup, the class objects in the application will be left untouched during GC and will always be considered live.To learn more click here
-XprofProfiles the running program and sends profiling data to standard output. This option is provided as a utility that is useful in program development and is not intended to be used in production systems. To learn more click here
-XrsReduces the use of operating system signals by the JVM, its behavior varies depending on the operating system.To learn more click here
-Xshare:<mode>Sets the class data sharing Class Data Sharing (CDS) mode. Possible mode arguments for this option include the following: auto, on, off, dump.To learn more click here
-XshowSettings:<category>Shows current settings related to the JVM. Possible category arguments : all, locale, properties, vm.To learn more click here
-XssNNNSets the thread stack size (in bytes). Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XstartOnFirstThreadOnly available for MacOS to ensures that the main() method of the main Java class is executed onthe first thread of the process.To learn more click here
-Xverify:<mode>Sets the mode of the bytecode verifier which ensures that class files are properly formed and satisfy the constraints listed in the JVM Specification. Possible mode arguments: remote, all, none.To learn more click here
-XX:ActiveProcessorCount=NOverrides the number of CPUs that the VM uses to calculate the size of thread pools it uses for various operations such as Garbage Collection and ForkJoinPool.To learn more click here
-XX:AllocateHeapAt=<filename>Takes a path to the file system and uses memory mapping to allocate the object heap on the memory device. Using this option enables the HotSpot VM to allocate the Java object heap on an alternative memory device, such as an NV-DIMM, specified by the user.To learn more click here
-XX:ArchiveClassesAtExit=<filename>Used to create a dynamic shared class datafile for Class Data Sharing.To learn more click here
-XX:-CompactStringsDisables the Compact Strings feature. When enabled, Java Strings containing only single-byte characters are internally represented and stored as single-byte-per-character Strings using ISO-8859-1/Latin-1 encoding. +CompactStrings re-enables this feature.To learn more click here
-XX:DumpLoadedClassList=<filename>is used to prepare a class list for use with Application Class Data Sharing. It produces an output file that lists the classes that were loaded during the execution of an application.To learn more click here
-XX:ErrorFile=<filename>Specifies the path and file name to which error data is written when an irrecoverable error occurs. By default, this file is created in the current working directory and named hs_err_pid%p.log where p is the identifier of the process that encountered the error.To learn more click here
-XX:+ExtensiveErrorReportsEnables the reporting of more extensive error information in the ErrorFile. This option can be turned on in environments where maximal information is desired. -ExtensiveErrorReports disables this option.To learn more click here
-XX:MaxDirectMemorySize=NNNSets the maximum total size (in bytes) of the java.nio package, direct-buffer allocations. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes. By default, the size is set to 0, meaning that the JVM chooses the size for NIO direct-buffer allocations automatically.To learn more click here
-XX:MaxNewSize=NNNSets the maximum size (in bytes) of the heap for the young generation (nursery). Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XX:NewSize=NNNSets the initial size (in bytes) of the heap for the young generation (nursery). Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes..To learn more click here
-XX:ObjectAlignmentInBytes=<alignment>Sets the memory alignment of Java objects (in bytes). By default, the value is set to 8 bytes. The specified value should be a power of 2, and must be within the range of 8 and 256 (inclusive). This option makes it possible to use compressed pointers with large Java heap sizes.To learn more click here
-XX:OnError=<command>Sets a custom command or a series of semicolon-separated commands to run when an irrecoverable error occurs. If the string contains spaces, then it must be enclosed in quotation marks.To learn more click here
-XX:OnOutOfMemoryError=<command>Sets a custom command or a series of semicolon-separated commands to run when an OutOfMemoryError exception is first thrown. If the string contains spaces, then it must be enclosed in quotation marks. To learn more click here
-XX:+PrintCommandLineFlagsEnables printing of JVM flags that appeared on the command line. It can be useful to know the ergonomic values set by the JVM, such as the heap space size and the selected garbage collector.To learn more click here
-XX:SharedArchiveFile=<filename>Specifies the path and name of the class data sharing (CDS) archive file.To learn more click here
-XX:SharedClassListFile=<filename>Specifies the text file that contains the names of the classes to store in the class data sharing (CDS) archive. This file contains the full name of one class per line, except slashes (/) replace dots (.).To learn more click here
-XX:+UnlockDiagnosticVMOptionsUnlocks the options intended for diagnosing the faults or performance problems with the JVM. By default, this option is disabled and diagnostic options aren’t available.To learn more click here
-XX:+UnlockExperimentalVMOptionsUnlocks the options that provide experimental features in the JVM. By default, this option is disabled and experimental features aren’t available.To learn more click here
-XX:-UseCompressedClassPointersDisables/Enables the use of compressed class pointers. It is only available or relevant on 64-bit JVMs. With compressed class pointers enabled, object references are represented as 32-bit offsets instead of 64-bit pointers.To learn more click here
-XX:-UseCompressedOopsDisables/Enables the use of compressed pointers. It is only available or relevant on 64-bit JVMs. With compressed oops enabled, object references are represented as 32-bit offsets instead of 64-bit pointers.To learn more click here
-XX:+HeapDumpOnOutOfMemoryErrorEnables the dumping of the Java heap to a file in the current directory by using the heap profiler (HPROF) when a  java.lang.OutOfMemoryError exception is thrown.To learn more click here
-XX:HeapDumpPath=<file-path>Sets the path and file name for writing the heap dump provided by the heap profiler (HPROF) when the – HeapDumpOnOutOfMemoryError option is set. By default, the file is created in the current working directory, and it’s named java_pid<pid>.hprof where <pid> is the identifier of the process that caused the error.To learn more click here
-XinternalversionDisplays more detailed JVM version information than the -version option, and then exits.To learn more click here
-XX:LargePageSizeInBytes=sizeSets the maximum large page size (in bytes) used by the JVM. The size argument must be a valid page size supported by the environment to have any effect. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XlogConfigure or enable logging with the Java Virtual Machine (JVM) unified logging framework.To learn more click here
-Xloggc:<file-path>Sets the file to which verbose GC events information should be redirected for logging. To learn more click here
-XX:MaxHeapFreeRatio=<maximum>Sets the maximum allowed percentage of free heap space (0 to 100) after a GC event. If free heap space expands above this value, then the heap is shrunk. By default, this value is set to 70%.To learn more click here
-XX:MinHeapFreeRatio=<minimum>Sets the minimum allowed percentage of free heap space (0 to 100) after a GC event. If free heap space falls below this value, then the heap is expanded. By default, this value is set to 40%.To learn more click here
-XX:+OptimizeStringConcatEnables the optimization of String concatenation operations. This option is enabled by default. To disable the optimization of String concatenation operations, specify -XX:-OptimizeStringConcat.To learn more click here
-XX:SurvivorRatio=<ratio>Sets the ratio between eden space size and survivor space size. By default, this option is set to 8.To learn more click here
-XX:+UseG1GCEnables the use of the garbage-first (G1) garbage collector. It’s a server-style garbage collector, targeted for multiprocessor machines with a large amount of RAM. By default, this option is enabled and G1 is used as the default garbage collector.To learn more click here
-XX:+UseLargePagesEnables the use of large page memory. By default, this option is disabled and large page memory isn’t used.To learn more click here
-XX:+UseParallelGCEnables the use of the parallel scavenge garbage collector (throughput collector) to improve the performance of applications by leveraging multiple processors.To learn more click here
-XX:+UseParNewGCUses a parallel version of the young generation copying collector alongside the default collector. This minimizes pauses by using all available CPUs in parallel. The collector is compatible with both the default collector and the Concurrent Mark and Sweep (CMS) collector.To learn more click here
-XX:+UseSerialGCEnables the use of the serial garbage collector. This is generally the best choice for small and simple applications that don’t require any special functionality from garbage collection.To learn more click here
-XX:+UseStringDeduplicationEnables string deduplication, which reduces the memory footprint of String objects on the Java heap by taking advantage of the fact that many String objects are identical, therefore can point to and share the same character array.To learn more click here
-XX:+UseZGCEnables the use of the Z garbage collector (ZGC). This is a low latency garbage collector, providing max pause times of a few milliseconds, at some throughput cost.To learn more click here
-XX:+AggressiveHeapEnables Java heap optimization. This sets various parameters to be optimal for long-running jobs with intensive memory allocation, based on the configuration of the computer (RAM and CPU).To learn more click here
-XX:CompilerDirectivesFile=<file>Sets the number of threads used for concurrent GC. Sets threads to approximately 1/4 of the number of parallel garbage collection threads.To learn more click here
-XX:ConcGCThreads=<threads>Sets the number of threads used for concurrent GC. Sets threads to approximately 1/4 of the number of parallel garbage collection threads.To learn more click here
-XX:+DisableAttachMechanismDisables the mechanism that lets tools attach to the JVM. By default, this option is disabled, meaning that the attach mechanism is enabled and that the diagnostics and troubleshooting tools such as jcmd, jstack, jmap, and jinfo can be used.To learn more click here
-XX:FlightRecorderOptions =parameter=valueSets the parameters that control the behavior of JFR.The following list contains the available JFR parameter=value entries:globalbuffersize=sizemaxchunksize=sizememorysize=sizenumglobalbuffersold-object-queue-size=number-of-objectsrepository=pathretransform={true|false}samplethreads={true|false}stackdepth=depththreadbuffersize=sizeTo learn more click here
-XX:G1HeapRegionSize=sizeSets the size of the regions into which the Java heap is subdivided when using the garbage-first (G1) collector. The value is a power of 2 and can range from 1 MB to 32 MB. To learn more click here
-XX:G1HeapWastePercent=percentSets the percentage of heap that you’re willing to waste. The Java HotSpot VM doesn’t initiate the mixed garbage collection cycle when the reclaimable percentage is less than the heap waste percentage. The default is 5 percent.To learn more click here
-XX:G1MaxNewSizePercent=percentSets the percentage of the heap size to use as the maximum for the young generation size. The default value is 60 percent of the Java heap.To learn more click here
-XX:G1MixedGCCountTarget=targetSets the target number of mixed garbage collections after a marking cycle to collect old regions with at most G1MixedGCLIveThresholdPercent livedata.To learn more click here
-XX:G1ReservePercent=percentSets the percentage of the heap (0 to 50) that’s reserved as a false ceiling to reduce the possibility of promotion failure for the G1 collector. By default, this option is set to 10%.To learn more click here
-XX:InitialHeapSize=sizeSets the initial size (in bytes) of the memory allocation pool. This value must be either 0, or a multiple of 1024 and greater than 1 MB. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XX:InitialRAMPercentage=percentSets the initial amount of memory that the JVM will use for the Java heap before applying ergonomics heuristics as a percentage of the maximum amount determined as described in the -XX:MaxRAM option.To learn more click here
-XX:InitialSurvivorRatio=sizeSets the initial survivor space ratio used by the throughput garbage collector (which is enabled by the -XX:+UseParallelGC option).To learn more click here
-XX:InitiatingHeapOccupancyPercent=percentSets the percentage of the old generation occupancy (0 to 100) at which to start the first few concurrent marking cycles for the G1 garbage collector. By default, the initiating value is set to 45%.To learn more click here
-XX:MaxGCPauseMillis=timeSets a target for the maximum GC pause time (in milliseconds). This is a soft goal, and the JVM will make its best effort to achieve it. The specified value doesn’t adapt to the heap size.To learn more click here
-XX:MaxHeapSize=sizeSets the maximum size (in byes) of the memory allocation pool. This value must be a multiple of 1024 and greater than 2 MB. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XX:MaxMetaspaceSize=sizeSets the maximum amount of native memory that can be allocated for class metadata. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XX:MaxRAMPercentage=percentSets the maximum amount of memory that the JVM may use for the Java heap before applying ergonomics heuristics as a percentage of the maximum amount determined as described in the -XX:MaxRAM option. The default value is 25 percent.To learn more click here
-XX:MetaspaceSize=sizeSets the size of the allocated class metadata space that triggers a garbage collection the first time it’s exceeded.To learn more click here
-XX:MinHeapSize=sizeSets the minimum size (in bytes) of the memory allocation pool. This value must be either 0, or a multiple of 1024 and greater than 1 MB. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XX:MinMetaspaceFreeRatio=ratioSets the required lower boundary ratio of metaspace region that needs to be available after garbage collection.To learn more click here
-XX:MinRAMPercentage=percentSets the maximum amount of memory that the JVM may use for the Java heap before applying ergonomics heuristics as a percentage of the maximum amount determined by -XX:MaxRAM option for small heaps.To learn more click here 
-XX:NativeMemoryTracking=modeSpecifies the mode for tracking JVM native memory usage. Possible mode arguments for this option are off, summary, detail.To learn more click here
-XX:NewSizeThreadIncrease=sizeSets, in Kilobytes, the increment in young object space size, per active thread, to accomodate potentially faster object allocation rate.To learn more click here
-XX:ParallelGCThreads=threadsSets the number of the stop-the-world (STW) worker threads. The default value depends on the number of CPUs available to the JVM and the garbage collector selected.To learn more click here
-XX:PreserveFramePointerSelects between using the RBP register as a general purpose register (-XX:-PreserveFramePointer) and using the RBP register to hold the frame pointer of the currently executing method (-XX:+PreserveFramePointer) . If the frame pointer is available, then external profiling tools (for example, Linux perf) can construct more accurate stack traces.To learn more click here
-XX:+ScavengeBeforeFullGCEnables GC of the young generation before each full GC. To disable GC of the young generation before each full GC, specify the option -XX:-ScavengeBeforeFullGC.To learn more click here
-XX:ShrinkHeapInSteps={true,false}Incrementally reduces the Java heap to the target size, specified by the option -XX:MaxHeapFreeRatio. This option is enabled by default. If disabled, then it immediately reduces the Java heap to the target size instead of requiring multiple garbage collection cycles.To learn more click here
-XX:SoftRefLRUPolicyMSPerMB=timeSets the amount of time (in milliseconds) a softly reachable object is kept active on the heap after the last time it was referenced. To learn more click here
-XX:-StackTraceInThrowableThis option removes stack traces from exceptions.To learn more click here
-XX:ThreadStackSize=sizeSets the Java thread stack size (in kilobytes).To learn more click here
-XX:UseContainerSupportIt allows the VM to determine the amount of memory and number of processors that are available to a Java process running in docker containers.To learn more click here
-XX:+UseGCOverheadLimitEnables/Disables the use of a policy that limits the proportion of time spent by the JVM on GC before an OutOfMemoryError exception is thrown. To learn more click here
-XX:ZUncommitDelay=secondsSets the amount of time (in seconds) that heap memory must have been unused before being uncommitted. By default, this option is set to 300 (5 minutes). To learn more click here
-agentlib:libname[=options]Loads the specified native agent library. After the library name, a comma-separated list of options specific to the library can be used.To learn more click here
-agentpath:pathname[=options]Loads the native agent library specified by the absolute path name. This option is equivalent to -agentlib but uses the full path and file name of the library.To learn more click here
-XX:+AggressiveOptsEnables the use of aggressive performance optimization features, which are expected to become default in upcoming releases.To learn more click here
-XX:AllocateInstancePrefetchLines=linesSets the number of lines to prefetch ahead of the instance allocation pointer. By default, the number of lines to prefetch is set to 1.To learn more click here
-XX:AllocatePrefetchDistance=sizeSets the size (in bytes) of the prefetch distance for object allocation. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XX:AllocatePrefetchInstr= instructionSets the prefetch instruction to prefetch ahead of the allocation pointer. Possible values are from 0 to 3. By default, the prefetch instruction is set to 0.To learn more click here
-XX:AllocatePrefetchLines=linesSets the number of cache lines to load after the last object allocation by using the prefetch instructions generated in compiled code. The default value is 1 if the last allocated object was an instance, and 3 if it was an array.To learn more click here
-XX:AllocatePrefetchStepSize=sizeSets the step size (in bytes) for sequential prefetch instructions. Units can be expressed by k, K – kilobytes, m, M – megabytes, g, G – gigibytes, t, T – terabytes, no unit – bytes.To learn more click here
-XX:AllocatePrefetchStyle=styleSets the generated code style for prefetch instructions. The style argument is an integer from 0 to 3.To learn more click here
-XX:+AlwaysPreTouchRequests the VM to touch every page on the Java heap after requesting it from the operating system and before handing memory out to the application.To learn more click here
-XX:-BackgroundCompilationDisables background compilation. This option is enabled by default. To enable background compilation, specify -XX:+BackgroundCompilation.To learn more click here
-XX:CICompilerCount=threadsSets the number of compiler threads to use for compilation. By default, the number of compiler threads is selected automatically depending on the number of CPUs and memory available for compiled code.To learn more click here
-XX:[+|-]CMSClassUnloadingEnabledEnables/Disables class unloading when using the concurrent mark-sweep (CMS) garbage collector. This option is enabled by default. To learn more click here
-XX:CMSExpAvgFactor=precentSets the percentage of time (0 to 100) used to weight the current sample when computing exponential averages for the concurrent collection statistics. By default, the exponential averages factor is set to 25%.To learn more click here

Leave a Reply

Powered by WordPress.com.

Up ↑

%d bloggers like this: