Skip to content

Commit 3a38ce6

Browse files
author
duke
committedJul 8, 2021
Automatic merge of jdk:master into master
2 parents 113e474 + 4f322a9 commit 3a38ce6

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed
 

‎test/hotspot/jtreg/gc/shenandoah/TestRefprocSanity.java

+17-10
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@
2727
* @summary Test that null references/referents work fine
2828
* @requires vm.gc.Shenandoah
2929
*
30-
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
30+
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
3131
* -XX:+UseShenandoahGC
3232
* -XX:+ShenandoahVerify
3333
* TestRefprocSanity
3434
*
35-
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
35+
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
3636
* -XX:+UseShenandoahGC
3737
* TestRefprocSanity
3838
*
39-
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
39+
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
4040
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
4141
* TestRefprocSanity
4242
*/
@@ -46,16 +46,16 @@
4646
* @summary Test that null references/referents work fine
4747
* @requires vm.gc.Shenandoah
4848
*
49-
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
49+
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
5050
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
5151
* -XX:+ShenandoahVerify
5252
* TestRefprocSanity
5353
*
54-
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
54+
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
5555
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
5656
* TestRefprocSanity
5757
*
58-
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
58+
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
5959
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
6060
* TestRefprocSanity
6161
*/
@@ -64,13 +64,15 @@
6464

6565
public class TestRefprocSanity {
6666

67-
static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation
68-
static final int WINDOW = 10_000;
67+
static final long TARGET_MB = Long.getLong("target", 1_000); // 1 Gb allocation
68+
static final int WINDOW = 1_000;
6969

7070
static final Reference<MyObject>[] refs = new Reference[WINDOW];
7171

72+
static Object sink;
73+
7274
public static void main(String[] args) throws Exception {
73-
long count = TARGET_MB * 1024 * 1024 / 32;
75+
long count = TARGET_MB * 1024 * 1024 / 128;
7476
int rIdx = 0;
7577

7678
ReferenceQueue rq = new ReferenceQueue();
@@ -87,7 +89,12 @@ public static void main(String[] args) throws Exception {
8789
if (rIdx >= WINDOW) {
8890
rIdx = 0;
8991
}
90-
while (rq.poll() != null); // drain
92+
93+
// Do allocations to force GCs
94+
sink = new byte[100];
95+
96+
// Drain the refqueue
97+
while (rq.poll() != null);
9198
}
9299
}
93100

0 commit comments

Comments
 (0)
Please sign in to comment.