diff --git a/test/hotspot/jtreg/runtime/ClassInitErrors/TestOutOfMemoryDuringInit.java b/test/hotspot/jtreg/runtime/ClassInitErrors/TestOutOfMemoryDuringInit.java index 1001ede5447..2f8d0fee721 100644 --- a/test/hotspot/jtreg/runtime/ClassInitErrors/TestOutOfMemoryDuringInit.java +++ b/test/hotspot/jtreg/runtime/ClassInitErrors/TestOutOfMemoryDuringInit.java @@ -44,6 +44,10 @@ public class TestOutOfMemoryDuringInit { static void forceInit() { } static { while (theList != null) { + // Use the minimal allocation size to push heap occupation to + // the limit, ensuring there is not enough memory to create the + // ExceptionInInitializerError that the VM tries to create when + // the clinit throws the OOM. theList.add(new Object()); } }