Introduction
- Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
- Microbenchmark Suite
- Switch Expressions (Preview)
- JVM Constants API
- One AArch64 Port, Not Two
- Default CDS Archives
- Abortable Mixed Collections for G1
- Promptly Return Unused Committed Memory from G1
Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
JDK 12 has added a new Garbage Collection(GC) algorithm, named Shenandoah, which reduces GC pause times, by doing evacuation work concurrently with the running Java threads. It will be provided as an experimental feature, so in order to use it, XX:+UnlockExperimentalVMOptions is needed together with -XX:+UseShenandoahGC. This Garbage collector is implemented and supported by RedHat, for aarch64 and amd64.
A basic suite of microbenchmarks is added to JDK 12 source code, which makes it easy for developers to run existing microbenchmarks and create new ones.
Earlier, there were two ports contributed by Oracle. Both were targetting ARM 64-bit in jdk i.e. arm64 and aarch64. Remove all of the sources related to the arm64 port, while retaining the 32-bit ARM port and the 64-bit aarch64 port.
This release has introduced a constant API, to model nominal descriptions of key class-file and run-time artifacts, in particular constants that are loadable from the constant pool. This is a useful feature for tools to manipulate classes and methods.
CDS stands for class data-sharing, this feature enhances the build process, to generate a class data-sharing (CDS) archive, using the default class list, on 64-bit platforms.
The G1 Garbage Collector aborts the garbage collection process, in order to meet user-supplied pause time target, by splitting the set of to-be garbage collected regions (mixed collection set) into mandatory and optional parts, and aborts the garbage collection of optional parts, if pause time target will not be reached otherwise.
When low application activity is detected over a period, then this G1 garbage collector automatically returns the garbage-collected memory to the operating system. In prior releases, G1 was returning memory to the operating system, after a full GC scan.
This JDK release has a few java language changes, but more in the performance of java and its utilities. The garbage collection feature has been enhanced with class data-sharing improvements and so on. For a more detailed description, you can read here.
Switch Expressions (Preview)
There are two main changes:
- Introduction of case L -> syntax that removes the need for break statements, because only the statements next to -> are executed.
- Switch can be an expression, so it can have a value, or it can return a value.
Let's take an example to explain this. We have a traditional switch-case and new switch case; both features can be seen from the code, as shown below.
- public class SwitchCaseFeature {
- public static void main(String[] args) {
- final int day = Integer.valueOf(args[0]);
- switch (day) {
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- System.out.println("weekday");
- break;
- case 7:
- case 1:
- System.out.println("weekend");
- break;
- default:
- System.out.println("invalid");
- }
- switch (day) {
- case 2, 3, 4, 5, 6 -> System.out.println("weekday");
- case 7, 1 -> System.out.println("weekend");
- default -> System.out.println("invalid");
- }
- final String attr =
- switch (day) {
- case 2, 3, 4, 5, 6 -> "weekday";
- case 7, 1 -> "weekend";
- default -> {
- break "invalid";
- }
- };
- System.out.println(attr);
- }
- }
Microbenchmark Suite
- Based on the [Java Microbenchmark Harness (JMH)]
- Stable and tuned benchmarks, targeted for continuous performance testing
One AArch64 Port, Not Two
JVM Constants API
Default CDS Archives
- Startup time improvements out-of-the-box
- Eliminates the need for users to run -Xshare: dump to benefit from CDS

Join the conversation! Your thoughts help the community grow.