The JVM has several Garbage Collectors available that you are able to specify, each with its own advantages. In Java 11 the Z Garbage Collector was introduced and now with Java 13 further improvements to this Garbage Collector have been introduced.
What is the Z Garbage Collector
The Z Garbage Collector (ZGC) is an optional Garbage Collector (GC) added as of JDK 11 for Linux/x64. This GC aims to keep pause time to below 10ms whilst handling heaps of any size.
The heap for the ZGC when it was first introduced would allow memory usage to be allocated but not deallocated. This means the amount of allocated memory would increase but never decrease. If your application requires more memory on start up than during continued operation the application would hold on to more memory than required.
This is the reason for JEP-351 being added to JDK 13.
JEP-351: ZGC: Uncommit Unused Memory
As detailed above, the ZGC could not uncommit allocated memory back to the operating system before JEP-351.
With the introduction of JPED-351 the ZGC will be able to uncommit memory so it is available for the operating system again.
The ZGC consists of a set of heap regions called ZPages, each containing variable amounts of memory. When ZPages are freed they are added to a page cache ready for reuse.
These cached pages are not currently used in the application can could be uncommitted.
In this version the ZGC would use a simple time out policy to determine when a ZPage is uncommitted but more sophisticated poloicies could be introduced in the future.
As of this version for the OpenJDK, support for Linux/AArch64 has also been included.
What benefits does this have?
These improvements have several obvious benefits on preformance of an application as we keep ensure our memory allocation is limited to what we actually need.
This would be even more beneficial in Container environments where resources are limited or there is a fee involved based on resources used.
In environments where an application may become idel and others continue running the ZGC can free up more memory for other applications.
It should be noted that this functionality already exists in G1 and Shenandoah GCs, adding it to ZGC makes it much more effective for many users.
Are you a Developer working with PDF files?
Our developers guide contains a large number of technical posts to help you understand the PDF file Format.
Do you need to solve any of these problems?
|Display PDF documents in a Web app|
|Use PDF Forms in a web browser|
|Convert PDF Documents to an image|
|Work with PDF Documents in Java|