RFR: 8377944: LowMemoryTest2.java#id1 intermittent fails OOME: Metaspace

SendaoYan syan at openjdk.org
Sun Feb 15 13:23:44 UTC 2026


Hi all,

Test java/lang/management/MemoryMXBean/LowMemoryTest2.java#id1 intermittent fails "java.lang.OutOfMemoryError: Metaspace". The test log shows that MemoryPoolMXBean.isUsageThresholdExceeded() always return true but MemoryPoolMXBean.getUsageThresholdCount() always return zero. The comment in this test says that "UsageThresholdCount is only updated during GC.", so it seems that the System.gc() do not trigger GC actually, so test always allocate new classes and then throw OOME in metaspace.

This PR use `WhiteBox.getWhiteBox().fullGC()` instead of `System.gc()` to make sure the GC to be trigger all the time. Change has been verified locally on linux-aarch64 and linux-x64.

-------------

Commit messages:
 - Update copyright year
 - 8377944: LowMemoryTest2.java#id1 intermittent fails OOME: Metaspace

Changes: https://git.openjdk.org/jdk/pull/29729/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29729&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377944
  Stats: 16 lines in 1 file changed: 2 ins; 4 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/29729.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29729/head:pull/29729

PR: https://git.openjdk.org/jdk/pull/29729


More information about the core-libs-dev mailing list