< prev index next >

test/jdk/jdk/jfr/event/oldobject/TestClassLoaderLeak.java

Print this page

23 
24 package jdk.jfr.event.oldobject;
25 
26 import java.lang.reflect.Array;
27 import java.util.ArrayList;
28 import java.util.List;
29 
30 import jdk.jfr.Recording;
31 import jdk.jfr.consumer.RecordedClass;
32 import jdk.jfr.consumer.RecordedEvent;
33 import jdk.jfr.consumer.RecordedObject;
34 import jdk.jfr.internal.test.WhiteBox;
35 import jdk.test.lib.Asserts;
36 import jdk.test.lib.jfr.EventNames;
37 import jdk.test.lib.jfr.Events;
38 
39 /**
40  * @test
41  * @requires vm.flagless
42  * @requires vm.hasJFR
43  * @requires vm.flagless
44  * @comment Marked as flagless until JDK-8322597 is fixed
45  * @library /test/lib /test/jdk
46  * @modules jdk.jfr/jdk.jfr.internal.test
47  * @run main/othervm -XX:TLABSize=2k -Xmx64m jdk.jfr.event.oldobject.TestClassLoaderLeak
48  */
49 public class TestClassLoaderLeak {
50 
51     public static List<Object> classObjects = new ArrayList<>(OldObjects.MIN_SIZE);
52 
53     public static void main(String[] args) throws Exception {
54         WhiteBox.setWriteAllObjectSamples(true);
55 
56         try (Recording r = new Recording()) {
57             r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
58             r.start();
59             TestClassLoader testClassLoader = new TestClassLoader();
60             for (Class<?> clazz : testClassLoader.loadClasses(OldObjects.MIN_SIZE / 200)) {
61                 // Allocate array to trigger sampling code path for interpreter / c1
62                 for (int i = 0; i < 200; i++) {
63                     Object classArray = Array.newInstance(clazz, 20);

23 
24 package jdk.jfr.event.oldobject;
25 
26 import java.lang.reflect.Array;
27 import java.util.ArrayList;
28 import java.util.List;
29 
30 import jdk.jfr.Recording;
31 import jdk.jfr.consumer.RecordedClass;
32 import jdk.jfr.consumer.RecordedEvent;
33 import jdk.jfr.consumer.RecordedObject;
34 import jdk.jfr.internal.test.WhiteBox;
35 import jdk.test.lib.Asserts;
36 import jdk.test.lib.jfr.EventNames;
37 import jdk.test.lib.jfr.Events;
38 
39 /**
40  * @test
41  * @requires vm.flagless
42  * @requires vm.hasJFR
43  * @requires !(vm.opt.final.UseCompactObjectHeaders == true | vm.opt.final.UseShenandoahGC == true)
44  * @comment Marked as flagless until JDK-8322597 is fixed
45  * @library /test/lib /test/jdk
46  * @modules jdk.jfr/jdk.jfr.internal.test
47  * @run main/othervm -XX:TLABSize=2k -Xmx64m jdk.jfr.event.oldobject.TestClassLoaderLeak
48  */
49 public class TestClassLoaderLeak {
50 
51     public static List<Object> classObjects = new ArrayList<>(OldObjects.MIN_SIZE);
52 
53     public static void main(String[] args) throws Exception {
54         WhiteBox.setWriteAllObjectSamples(true);
55 
56         try (Recording r = new Recording()) {
57             r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
58             r.start();
59             TestClassLoader testClassLoader = new TestClassLoader();
60             for (Class<?> clazz : testClassLoader.loadClasses(OldObjects.MIN_SIZE / 200)) {
61                 // Allocate array to trigger sampling code path for interpreter / c1
62                 for (int i = 0; i < 200; i++) {
63                     Object classArray = Array.newInstance(clazz, 20);
< prev index next >