JEP 364: ZGC on macOS (Experimental)

OwnerErik Österlund
TypeFeature
ScopeImplementation
StatusClosed / Delivered
Release14
Componenthotspot / gc
Discussionhotspot dash gc dash dev at openjdk dot java dot net
EffortS
DurationS
DependsJEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
Relates toJEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production)
Reviewed byMikael Vidstedt, Per Liden
Endorsed byMikael Vidstedt
Created2019/08/09 13:06
Updated2021/08/28 00:16
Issue8229358

Summary

Port the ZGC garbage collector to macOS.

Motivation

While we expect users that require the scalability of ZGC to use Linux-based environments, it is not uncommon that developers use Macs for local development and testing, before deploying applications. There are also users who wish to run desktop applications such as IDEs with ZGC.

Description

The macOS implementation of ZGC consists of two parts:

Alternatives

We attempted an alternative prototype using POSIX shared memory objects. It used a file descriptor approach, for multi mapped memory. We abandoned this approach because, a) it did not support large pages, and b) the macOS implementation of ftruncate may only be called once to set the size of a file, which made uncommitting memory impossible.

Testing

The tests that usually run for ZGC on Linux, will be run for macOS too.

Dependencies

The work to purge the VM of the assumption that GCs have one discontiguous memory reservation is required to pave the way for the macOS port. These changes are described in preparatory enhancements, to make reviewing easier: