javamacosgarbage-collectionjava-13shenandoah

How to enable Shenandoah Garbage Collector for OpenJDK13 on MacOS


I have the latest (13.0.1) OpenJDK on my Mac, but it does not seem to include Shenandoah. Am I crazy? I know it shipped. It works on my Linux machine. Is there a different download? Different flags?

~ $ java -XX:+UnlockExperimentalVMOptions -XX:+PrintCommandLineFlags -version                                                                                                         
 -XX:G1ConcRefinementThreads=4 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=134217728  
 -XX:MaxHeapSize=2147483648 -XX:MinHeapSize=6815736 -XX:+PrintCommandLineFlags 
 -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UnlockExperimentalVMOptions 
 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment (build 13.0.1+9)
OpenJDK 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
~ $ java -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+PrintCommandLineFlags -version                                                                                              
Error occurred during initialization of VM
Option -XX:+UseShenandoahGC not supported

Solution

  • I think this Red Hat blog post is probably related, especially considering that Shenandoah works on your Linux machine and not macOS.

    TL;DR: Red Hat led Shenandoah's development, so Oracle is hesitant to put it in OpenJDK. Not all builds support it as a result.