How to enable Shenandoah Garbage Collector for OpenJDK13 on MacOS

5.9k Views Asked by At

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
2

There are 2 best solutions below

3
On BEST ANSWER

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.

0
On

You have to build it for yourself if you want to use Shenandoah on MacOS, that's what most of the people are doing.

Adding this answer since I see a lot of people looking for Shenandoah on MacOS