Profile Image
vishnupriya

What is Unlock Experimental VM Options: -XX:+UnlockExperimentalVMOptions?

What is Unlock Experimental VM Options: -XX:+UnlockExperimentalVMOptions? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvm-argument

  • xx-unlockexperimentalvmoptions

  • x-unlockexperimentalvmoptions

  • Unlock Experimental VM Options

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:


• -XX:+UnlockExperimentalVMOptions


Description:


The -XX:+UnlockExperimentalVMOptions flag unlocks experimental JVM features. These features may be unstable and are therefore not available by default,
so this flag is required to make them available.


Using experimental features enabled by this flag is not encouraged in a production
system. They may crash or cause unexpected behaviour. Also the JVM vendor
will not provide support for experimental features.


There are a large number of experimental flags that can be unlocked. The
-XX:+PrintFlagsFinal option does not print experimental flags by default, but
using -XX:+PrintFlagsFinal together with -XX:+UnlockExperimentalVMOptions
causes the experimental flags to be printed. Although the output includes all
flags, the experimental flags are marked with {experimental}, which can be
used as the basis of a search. For example:

 

java -XX:+UnlockExperimentalVMOptions \
-XX:+PrintFlagsFinal -version | grep {experimental}


An excerpt of the output of this command, when used with Java 11, is as follows:

 

bool UnlockExperimentalVMOptions = true {experimental} {command line}
bool UseAOT = false {experimental} {default}
bool UseCriticalCMSThreadPriority = false {experimental} {default}
bool UseCriticalCompilerThreadPriority = false {experimental} {default}
bool UseCriticalJavaThreadPriority = false {experimental} {default}
bool UseEpsilonGC = false {experimental} {default}
bool UseFastUnorderedTimeStamps = false {experimental} {default}
bool UseZGC = false {experimental} {default}
uintx WorkStealingHardSpins = 4096 {experimental} {default}
uintx WorkStealingSleepMillis = 1 {experimental} {default}
uintx WorkStealingSpinToYieldRatio = 10 {experimental} {default}
uintx WorkStealingYieldsBeforeSleep = 5000 {experimental} {default}
Note that experimental features may become production features in future
versions of Java. For example the -XX:UseZGC option, which enables the Z
Garbage Collector, is shown as experimental on Java 11 above but is a production
feature on Java 17:
bool UseZGC = false {product} {default}
Conversely, experimental features may be dropped in future Java versions.

 

Default Value:


-XX:+UnlockExperimentalVMOptions is off by default, i.e. experimental features are not unavailable.


Errors:


Example of using a flag that requires -XX:+UnlockExperimentalVMOptions but
without supplying that flag:


java -XX:+G1MaxNewSizePercent


The output of the above command is:


Error: VM option 'G1MaxNewSizePercent' is experimental and must be
enabled via -XX:+UnlockExperimentalVMOptions.
Error: The unlock option must precede 'G1MaxNewSizePercent'.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

 

Arguments Related to -XX:+UnlockExperimentalVMOptions


TODO: too many to list individually

 

Related Posts:


None


NOTE:


If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your
insights will help the entire 10+ million java developer community to develop
one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvm-argument

  • xx-unlockexperimentalvmoptions

  • x-unlockexperimentalvmoptions

  • Unlock Experimental VM Options