< prev index next >

test/hotspot/jtreg/gc/g1/mixedgc/TestLogging.java

Print this page

        

@@ -164,11 +164,18 @@
 
         WB.youngGC();
         System.out.println("Allocating new objects to provoke mixed GC");
         // allocate more objects to provoke GC
         for (int i = 0; i < (TestLogging.ALLOCATION_COUNT * 20); i++) {
+            try {
             newObjects.add(new byte[TestLogging.ALLOCATION_SIZE]);
+            } catch (OutOfMemoryError e) {
+                newObjects.clear();
+                WB.youngGC();
+                WB.youngGC();
+                break;
+            }
         }
         // check that liveOldObjects still alive
         Asserts.assertTrue(WB.isObjectInOldGen(liveOldObjects),
                 "List of the objects is suppose to be in OldGen");
     }
< prev index next >