From 779e70568986ef27fca17671ebdb66af2ce843f5 Mon Sep 17 00:00:00 2001 From: Hiroshi Yamauchi Date: Mon, 26 Jan 2015 16:05:11 -0800 Subject: [PATCH] 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 --- test/114-ParallelGC/src/Main.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/114-ParallelGC/src/Main.java b/test/114-ParallelGC/src/Main.java index df2243c27..46029cf26 100644 --- a/test/114-ParallelGC/src/Main.java +++ b/test/114-ParallelGC/src/Main.java @@ -53,13 +53,17 @@ public class Main implements Runnable { } // Allocate objects to definitely run GC before quitting. + ArrayList l = new ArrayList(); try { - ArrayList l = new ArrayList(); for (int i = 0; i < 100000; i++) { l.add(new ArrayList(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(50); } -- 2.11.0