From 21b4bf89b4454d2af88762200e5d8b42e0d36cf4 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Fri, 25 Jul 2014 16:37:09 -0700 Subject: [PATCH] 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 --- test/114-ParallelGC/src/Main.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/114-ParallelGC/src/Main.java b/test/114-ParallelGC/src/Main.java index 2285872ab..15d5e5079 100644 --- a/test/114-ParallelGC/src/Main.java +++ b/test/114-ParallelGC/src/Main.java @@ -35,12 +35,19 @@ public class Main implements Runnable { 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(); } 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(i)); + } catch (OutOfMemoryError oom) { + // Ignore. + } } } + + private List l; } -- 2.11.0