We see sporadic failures in the jtreg test gc/z/TestAlwaysPreTouch.java running on macOS. The interesting output in this case might be "Address Space Size: 0M x 3 = 0M". It seems Address Space Size is calculated as 0 and then of course the heap reservation returns an error.
This happens only on macOS and only few times a month.
----------messages:(4/344)----------
command: main -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=8 -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
reason: User specified action: run main/othervm -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=8 -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
Mode: othervm [/othervm specified]
elapsed time (seconds): 0.365
----------configuration:(0/0)----------
----------System.out:(12/706)----------
[0.010s][info][gc,init] Initializing The Z Garbage Collector
[0.010s][info][gc,init] Version: 15.0.0.1-internal+0-adhoc.openjdk.jdk (fastdebug)
[0.010s][info][gc,init] NUMA Support: Disabled
[0.010s][info][gc,init] CPUs: 12 total, 12 available
[0.010s][info][gc,init] Memory: 32768M
[0.010s][info][gc,init] Large Page Support: Disabled
[0.010s][info][gc,init] Medium Page Size: 4M
[0.010s][info][gc,init] Workers: 8 parallel, 1 concurrent
[0.302s][info][gc,init] Address Space Type: Discontiguous/Unrestricted/Degraded
[0.302s][info][gc,init] Address Space Size: 0M x 3 = 0M
[0.302s][error][gc ] Failed to reserve enough address space for Java heap
[0.315s][info ][gc,init] Runtime Workers: 8 parallel
----------System.err:(2/108)----------
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
This happens only on macOS and only few times a month.
----------messages:(4/344)----------
command: main -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=8 -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
reason: User specified action: run main/othervm -XX:+UseZGC -Xlog:gc* -XX:+AlwaysPreTouch -XX:ParallelGCThreads=8 -Xms128M -Xmx128M gc.z.TestAlwaysPreTouch
Mode: othervm [/othervm specified]
elapsed time (seconds): 0.365
----------configuration:(0/0)----------
----------System.out:(12/706)----------
[0.010s][info][gc,init] Initializing The Z Garbage Collector
[0.010s][info][gc,init] Version: 15.0.0.1-internal+0-adhoc.openjdk.jdk (fastdebug)
[0.010s][info][gc,init] NUMA Support: Disabled
[0.010s][info][gc,init] CPUs: 12 total, 12 available
[0.010s][info][gc,init] Memory: 32768M
[0.010s][info][gc,init] Large Page Support: Disabled
[0.010s][info][gc,init] Medium Page Size: 4M
[0.010s][info][gc,init] Workers: 8 parallel, 1 concurrent
[0.302s][info][gc,init] Address Space Type: Discontiguous/Unrestricted/Degraded
[0.302s][info][gc,init] Address Space Size: 0M x 3 = 0M
[0.302s][error][gc ] Failed to reserve enough address space for Java heap
[0.315s][info ][gc,init] Runtime Workers: 8 parallel
----------System.err:(2/108)----------
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.