From 2196f1e1ac35c3d132d14e57af68d86f01824bd1 Mon Sep 17 00:00:00 2001 From: tschatzl Date: Mon, 18 Aug 2014 15:41:57 +0200 Subject: [PATCH] 8054362: gc/g1/TestEagerReclaimHumongousRegions2.java timeout Summary: Give the test a time limit of approximately one minute so that it exits early on slow machines. Reviewed-by: ehelin, dfazunen, brutisso --- test/gc/g1/TestEagerReclaimHumongousRegions2.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/gc/g1/TestEagerReclaimHumongousRegions2.java b/test/gc/g1/TestEagerReclaimHumongousRegions2.java index 147dc48ef..dafbde0ed 100644 --- a/test/gc/g1/TestEagerReclaimHumongousRegions2.java +++ b/test/gc/g1/TestEagerReclaimHumongousRegions2.java @@ -46,6 +46,8 @@ class ObjectWithSomeRefs { } class ReclaimRegionFast { + public static final long MAX_MILLIS_FOR_RUN = 50 * 1000; // The maximum runtime for the actual test. + public static final int M = 1024*1024; public static LinkedList garbageList = new LinkedList(); @@ -83,7 +85,14 @@ class ReclaimRegionFast { Object ref_from_stack = large1; + long start_millis = System.currentTimeMillis(); + for (int i = 0; i < 20; i++) { + long current_millis = System.currentTimeMillis(); + if ((current_millis - start_millis) > MAX_MILLIS_FOR_RUN) { + System.out.println("Finishing test because maximum runtime exceeded"); + break; + } // A set of large objects that will be reclaimed eagerly - and hopefully marked. large1 = new int[M - 20]; large2 = new int[M - 20]; -- GitLab