Fix 114-ParallelGC.
In main(), the outer ArrayList may still be reachable after the
try-catch under the interpreter or a compiler without a liveness
analysis and the last ArrayList allocation may fail due to an OOME.
This fixes 114-ParallelGC under the CC and the GSS collectors.
Bug: 12687968
Change-Id: Ie1082d38b2a677ec70fdc23b0187ae8ce0612808
diff --git a/test/114-ParallelGC/src/Main.java b/test/114-ParallelGC/src/Main.java
index df2243c..46029cf 100644
--- a/test/114-ParallelGC/src/Main.java
+++ b/test/114-ParallelGC/src/Main.java
@@ -53,13 +53,17 @@
}
// Allocate objects to definitely run GC before quitting.
+ ArrayList<Object> l = new ArrayList<Object>();
try {
- ArrayList<Object> l = new ArrayList<Object>();
for (int i = 0; i < 100000; i++) {
l.add(new ArrayList<Object>(i));
}
} catch (OutOfMemoryError oom) {
}
+ // Make the (outer) ArrayList unreachable. Note it may still
+ // be reachable under an interpreter or a compiler without a
+ // liveness analysis.
+ l = null;
new ArrayList<Object>(50);
}