Skip to content

Commit eb8267d

Browse files
committed
8316585: [REDO] runtime/InvocationTests spend a lot of time on dependency verification
Backport-of: 1e930db3c7dec24223eea9f36052bb753f91e282
1 parent 31c759d commit eb8267d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/hotspot/jtreg/runtime/InvocationTests/shared/AbstractGenerator.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public abstract class AbstractGenerator {
3535
protected final boolean dumpClasses;
3636
protected final boolean executeTests;
3737
private static int testNum = 0;
38+
private static int classesBeforeGC = 0;
3839

3940
protected AbstractGenerator(String[] args) {
4041
List<String> params = new ArrayList<String>(Arrays.asList(args));
@@ -96,6 +97,14 @@ protected boolean exec(Map<String, byte[]> classes, String description, String c
9697

9798
testNum++;
9899

100+
// Every N-th classes, force a GC to kick out the loaded classes from previous tests.
101+
// Different tests come in with different number of classes, so testNum is not reliable.
102+
classesBeforeGC -= classes.size();
103+
if (classesBeforeGC <= 0) {
104+
System.gc();
105+
classesBeforeGC = 3000;
106+
}
107+
99108
String caseDescription = String.format("%4d| %s", testNum, description);
100109

101110
// Create test executor for a single case

0 commit comments

Comments
 (0)