From 1e930db3c7dec24223eea9f36052bb753f91e282 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Mon, 16 Oct 2023 08:00:48 +0000 Subject: [PATCH] 8316585: [REDO] runtime/InvocationTests spend a lot of time on dependency verification Reviewed-by: vlivanov, stuefe, mli --- .../InvocationTests/shared/AbstractGenerator.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/hotspot/jtreg/runtime/InvocationTests/shared/AbstractGenerator.java b/test/hotspot/jtreg/runtime/InvocationTests/shared/AbstractGenerator.java index 9d5a7925fab..bfc793a0aa2 100644 --- a/test/hotspot/jtreg/runtime/InvocationTests/shared/AbstractGenerator.java +++ b/test/hotspot/jtreg/runtime/InvocationTests/shared/AbstractGenerator.java @@ -35,6 +35,7 @@ public abstract class AbstractGenerator { protected final boolean dumpClasses; protected final boolean executeTests; private static int testNum = 0; + private static int classesBeforeGC = 0; protected AbstractGenerator(String[] args) { List params = new ArrayList(Arrays.asList(args)); @@ -96,6 +97,14 @@ public abstract class AbstractGenerator { testNum++; + // Every N-th classes, force a GC to kick out the loaded classes from previous tests. + // Different tests come in with different number of classes, so testNum is not reliable. + classesBeforeGC -= classes.size(); + if (classesBeforeGC <= 0) { + System.gc(); + classesBeforeGC = 3000; + } + String caseDescription = String.format("%4d| %s", testNum, description); // Create test executor for a single case