| Garbage collectors: Sometimes you need to take out the trash |
|
|
| Week of June 20, 2022 |
| See how Java’s garbage collectors have evolved from JDK 8 to JDK 18 |
|
|
|
|
|
All garbage collectors do the same basic things. They allocate memory. They detect memory that’s never going to be used again. They then make this unneeded memory available for future allocations.
All garbage collectors do different things, depending on the profile of their applications. Some prioritize allocating memory but are less efficient when it comes to detecting unreachable memory. Some garbage collectors are superfast but require considerable resources, such as memory, from the JVM. Some are less efficient but use less memory.
The three main performance metrics for garbage collectors are throughput, latency, and memory footprint. Java has several garbage collectors, each designed to optimize a specific group of performance metrics.
Thomas Schatzl, a member of Oracle’s garbage collector team, describes the JVM’s Parallel, G1, ZGC, Serial, and Shenandoah garbage collectors, and he details how they have evolved since JDK 8 was released in 2014.
Take care, Alan Zeichick Editor in Chief, Java Magazine @zeichick
P.S. Thomas also discusses Epsilon, which doesn’t satisfy all the requirements of a garbage collector, but which can be useful in some special circumstances. |
|
| The newest Java Magazine articles |
Java garbage collection: The 10-release evolution from JDK 8 to JDK 18 The general availability of JDK 18 marked the 10th release since the still-popular JDK 8 release in March 2014. This anniversary was a good opportunity for Thomas Schatzl to take pause and see what happened with the HotSpot JVM’s garbage collectors, such as Parallel, G1, and ZGC, along the way.
JUG spotlight: The San Francisco Java User Group From time to time, Java Magazine spotlights a particular JUG; for this article, we talked to Pieter Humphrey, a leader of the San Francisco Java User Group (SFJUG)—with 8,400 members, this is the largest physical JUG in the world.
Curly Braces #5: Null is not nothing The concept of null is squishy—but Eric Bruno points out that null is a critical component of modern programming. Imagine being forced to write Java code without using null—or doing the same in C++, JavaScript, Python, and so on? No null assignments; no checking for null; no null nothing.
Bruce Eckel on Java modules, text blocks, and more This series on the newest features of Java concludes with an exploration of how modules make application packages more compact; text blocks, which allow you to easily create multiline text; better NullPointerException reporting; and effectively final variables in try-with-resources. |
|
| Have you tried these recent certification exam quizzes? |
|
|
|
|
|
| Join us in Las Vegas from October 17–20 to explore a wide range of Java technical and community topics that address modern application development and ecosystem participation. Keynotes, labs, and sessions showcase Java’s value—and strengthen your Java skills. Registration is open! |
|
|
| Complimentary subscription to Java Magazine |
Java Magazine is a deep dive into Java and the JVM. Find detailed explanations about the language and the platform written by experts and members of the Java development team.
Join a quarter of a million subscribers in getting useful, authoritative programming information delivered directly to your inbox. |
|
|
|
|
|