The test was using a fixed -XX:MaxMetaspaceSize=25m for all platforms. Investigation (via jcmd VM.metaspace) revealed that the higher limit is needed only on platforms where CDS is unavailable (e.g. AIX). Without CDS, all 3,340 classes are allocated in classic metaspace (~23.4 MB committed), whereas on Linux with CDS active, 1,364 core JDK classes are mapped from the shared archive into a separate "Shared Class Space" that does not count against -XX:MaxMetaspaceSize, keeping classic metaspace usage at ~13.6 MB.
This was validated by running the test on Linux with -Xshare:off -XX:MaxMetaspaceSize=17m, which reproduces the same OOM as AIX. When running with 25m, the usage is very similar to AIX. This change splits the test into two variants based on CDS availability: > id=cds (@requires vm.cds): runs with -XX:MaxMetaspaceSize=17m id=nocds (@requires !vm.cds): runs with -XX:MaxMetaspaceSize=25m An explanatory comment is also included so the reasoning is clear to future readers. JBS Issue: [JDK-8336666](https://bugs.openjdk.org/browse/JDK-8336666) --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - Clarification fix Changes: https://git.openjdk.org/jdk/pull/32254/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32254&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8336666 Stats: 22 lines in 1 file changed: 20 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/32254.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/32254/head:pull/32254 PR: https://git.openjdk.org/jdk/pull/32254
