ART: Fix run-test 114 ParallelGC to account for OOM
This catches any OOMs and doesn't pollute the log.
Bug: 16406852
Change-Id: I1bc95091ccae35a8cb5f2ef0a789f8c8ce5209d0
diff --git a/test/114-ParallelGC/src/Main.java b/test/114-ParallelGC/src/Main.java
index 2285872..15d5e50 100644
--- a/test/114-ParallelGC/src/Main.java
+++ b/test/114-ParallelGC/src/Main.java
@@ -35,12 +35,19 @@
private Main(int id) {
this.id = id;
+ // Allocate this early so it's independent of how the threads are scheduled on startup.
+ this.l = new ArrayList<Object>();
}
public void run() {
- List l = new ArrayList();
- for (int i = 0; i < 400; i++) {
- l.add(new ArrayList(i));
+ for (int i = 0; i < 1000; i++) {
+ try {
+ l.add(new ArrayList<Object>(i));
+ } catch (OutOfMemoryError oom) {
+ // Ignore.
+ }
}
}
+
+ private List<Object> l;
}