8210193: [TESTBUG]gc/g1/mixedgc/TestOldGenCollectionUsage.java fails intermittently with OutOfMemoryError in CDS mode

Increase java heap size in TestOldGenCollectionUsage. Catch OOM in tests.

Reviewed-by: phh, iklam
This commit is contained in:
Jiangli Zhou 2018-09-13 13:30:07 -04:00
parent 734a258afb
commit 989d55d3ed
2 changed files with 18 additions and 3 deletions
test/hotspot/jtreg/gc/g1/mixedgc

@ -166,7 +166,14 @@ class MixedGCProvoker {
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++) {
newObjects.add(new byte[TestLogging.ALLOCATION_SIZE]);
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),

@ -33,7 +33,7 @@
* @modules java.management
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -verbose:gc -XX:SurvivorRatio=1 -Xmx12m -Xms12m -XX:MaxTenuringThreshold=1 -XX:InitiatingHeapOccupancyPercent=100 -XX:-G1UseAdaptiveIHOP -XX:G1MixedGCCountTarget=4 -XX:MaxGCPauseMillis=30000 -XX:G1HeapRegionSize=1m -XX:G1HeapWastePercent=0 -XX:G1MixedGCLiveThresholdPercent=100 TestOldGenCollectionUsage
* @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -verbose:gc -XX:SurvivorRatio=1 -Xmx14m -Xms14m -XX:MaxTenuringThreshold=1 -XX:InitiatingHeapOccupancyPercent=100 -XX:-G1UseAdaptiveIHOP -XX:G1MixedGCCountTarget=4 -XX:MaxGCPauseMillis=30000 -XX:G1HeapRegionSize=1m -XX:G1HeapWastePercent=0 -XX:G1MixedGCLiveThresholdPercent=100 TestOldGenCollectionUsage
*/
import jdk.test.lib.Asserts;
@ -209,7 +209,15 @@ public class TestOldGenCollectionUsage {
// Provoke a mixed collection. G1MixedGCLiveThresholdPercent=100
// guarantees that full old gen regions will be included.
for (int i = 0; i < (ALLOCATION_COUNT * 20); i++) {
newObjects.add(new byte[ALLOCATION_SIZE]);
try {
newObjects.add(new byte[ALLOCATION_SIZE]);
} catch (OutOfMemoryError e) {
newObjects.clear();
WB.youngGC();
WB.youngGC();
System.out.println("OutOfMemoryError is reported, stop allocating new objects");
break;
}
}
// check that liveOldObjects still alive
Asserts.assertTrue(WB.isObjectInOldGen(liveOldObjects),