Enable ZGC in OpenJDK ports?

I was wondering if anyone can shed light on why ZGC is not enabled in the FreeBSD ports for OpenJDK. From what I can find ZGC "should" function on FreeBSD, with that said I was finding conflicting information. Could anyone give me a bit more detail / direction? Is it something I can enable in my own port? The files are present in the source code for the OpenJDK ports, it's more like they have been disabled.
 
So I'm trying to use ZGC with OpenJDK on FreeBSD to run a Minecraft server but this seems to be be only discussion about ZGC not working.

The 2019 comment about it only being supported on Linux no longer is valid as it is in the BSD src tree: https://github.com/battleblow/jdk24u/tree/master/src/hotspot/os/bsd/gc/z
Oddly enough, that's my use case too. Despite seeing ZGC in the sources, I can't use ZGC flags with java 23, 24, or 25 on FreeBSD 14.3.

Code:
openjdk23-23.0.2+7.2           Java Development Kit 23
openjdk24-24.0.2+12.2_2        Java Development Kit 24
openjdk25-25.0.1+8.f.1         Java Development Kit 25

Code:
minecraft@heimdall:~/servers/TEST$ /usr/local/openjdk23/bin/java -Xlog:gc -version
[0.001s][info][gc] Using G1
openjdk version "23.0.2" 2025-01-21
OpenJDK Runtime Environment (build 23.0.2+7-2)
OpenJDK 64-Bit Server VM (build 23.0.2+7-2, mixed mode, sharing)
minecraft@heimdall:~/servers/TEST$ /usr/local/openjdk23/bin/java -XX:+UseZGC -Xlog:gc -version
Error occurred during initialization of VM
Option -XX:+UseZGC not supported
minecraft@heimdall:~/servers/TEST$ /usr/local/openjdk24/bin/java -Xlog:gc -version
[0.011s][info][gc] Using G1
openjdk version "24.0.2" 2025-07-15
OpenJDK Runtime Environment (build 24.0.2+12-2)
OpenJDK 64-Bit Server VM (build 24.0.2+12-2, mixed mode, sharing)
minecraft@heimdall:~/servers/TEST$ /usr/local/openjdk24/bin/java -XX:+UseZGC -Xlog:gc -version
Error occurred during initialization of VM
Option -XX:+UseZGC not supported
minecraft@heimdall:~/servers/TEST$ /usr/local/openjdk25/bin/java -Xlog:gc -version
[0.001s][info][gc] Using G1
openjdk version "25.0.1" 2025-10-21
OpenJDK Runtime Environment (build 25.0.1+8-freebsd-1)
OpenJDK 64-Bit Server VM (build 25.0.1+8-freebsd-1, mixed mode, sharing)
minecraft@heimdall:~/servers/TEST$ /usr/local/openjdk25/bin/java -XX:+UseZGC -Xlog:gc -version
Error occurred during initialization of VM
Option -XX:+UseZGC not supported

It also seems to reject flags for using large pages, huge pages, and transparent huge pages.

I can't seem to get the flags right to dump what it had been compiled with (ie: compiler feature flags).

FreeBSD makes a great Minecraft server host, especially with a little scripting to make ZFS snapshots at routine intervals. Unfortunately the G1 garbage collection time can be 15-30ms. ZGC promises to reduce that dramatically. I wonder if the Linux openjdk would run in emulation mode and include ZGC.
 
Back
Top