equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. |
2 * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved. |
3 * |
3 * |
4 * This code is free software; you can redistribute it and/or modify it |
4 * This code is free software; you can redistribute it and/or modify it |
5 * under the terms of the GNU General Public License version 2 only, as |
5 * under the terms of the GNU General Public License version 2 only, as |
6 * published by the Free Software Foundation. |
6 * published by the Free Software Foundation. |
7 * |
7 * |
37 * @key gc |
37 * @key gc |
38 * @requires vm.gc.Shenandoah & !vm.graal.enabled & (vm.bits == "64") |
38 * @requires vm.gc.Shenandoah & !vm.graal.enabled & (vm.bits == "64") |
39 * @compile TestHeapDump.java |
39 * @compile TestHeapDump.java |
40 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx128m -XX:ShenandoahGCHeuristics=aggressive -XX:-UseCompressedOops TestHeapDump |
40 * @run main/othervm/native/timeout=300 -agentlib:TestHeapDump -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -Xmx128m -XX:ShenandoahGCHeuristics=aggressive -XX:-UseCompressedOops TestHeapDump |
41 */ |
41 */ |
|
42 |
|
43 import java.lang.ref.Reference; |
42 |
44 |
43 public class TestHeapDump { |
45 public class TestHeapDump { |
44 |
46 |
45 private static final int NUM_ITER = 10000; |
47 private static final int NUM_ITER = 10000; |
46 |
48 |
84 int numObjs = heapdump(TestObject.class); |
86 int numObjs = heapdump(TestObject.class); |
85 if (numObjs != EXPECTED_OBJECTS) { |
87 if (numObjs != EXPECTED_OBJECTS) { |
86 throw new RuntimeException("Expected " + EXPECTED_OBJECTS + " objects, but got " + numObjs); |
88 throw new RuntimeException("Expected " + EXPECTED_OBJECTS + " objects, but got " + numObjs); |
87 } |
89 } |
88 } |
90 } |
|
91 Reference.reachabilityFence(array); |
|
92 Reference.reachabilityFence(localRoot); |
89 } |
93 } |
90 |
94 |
91 // We look for the instances of this class during the heap scan |
95 // We look for the instances of this class during the heap scan |
92 public static class TestObject {} |
96 public static class TestObject {} |
93 } |
97 } |