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

SendaoYan syan at openjdk.org
Tue Feb 24 12:12:12 UTC 2026


On Mon, 23 Feb 2026 13:52:53 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> 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.
>
> Marked as reviewed by cjplummer (Reviewer).

Thanks for the reviews @plummercj @dholmes-ora

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

PR Comment: https://git.openjdk.org/jdk/pull/29729#issuecomment-3951307925


More information about the serviceability-dev mailing list