Skip to content

Commit aefd4ac

Browse files
committed
8258734: jdk/jfr/event/oldobject/TestClassLoaderLeak.java failed with "RuntimeException: Could not find class leak"
Reviewed-by: mgronlun
1 parent d245a8c commit aefd4ac

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,22 @@ public static void main(String[] args) throws Exception {
5656
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
5757
r.start();
5858
TestClassLoader testClassLoader = new TestClassLoader();
59-
for (Class<?> clazz : testClassLoader.loadClasses(OldObjects.MIN_SIZE / 20)) {
59+
for (Class<?> clazz : testClassLoader.loadClasses(OldObjects.MIN_SIZE / 200)) {
6060
// Allocate array to trigger sampling code path for interpreter / c1
61-
for (int i = 0; i < 20; i++) {
61+
for (int i = 0; i < 200; i++) {
6262
Object classArray = Array.newInstance(clazz, 20);
63-
Array.set(classArray, i, clazz.newInstance());
63+
// No need to fill whole array
64+
for (int j = 0; j < 5; j++) {
65+
Array.set(classArray, j, clazz.getConstructors()[0].newInstance());
66+
}
6467
classObjects.add(classArray);
6568
}
6669
}
6770
r.stop();
6871
List<RecordedEvent> events = Events.fromRecording(r);
6972
Events.hasEvents(events);
7073
for (RecordedEvent e : events) {
74+
System.out.println(e);
7175
RecordedObject object = e.getValue("object");
7276
RecordedClass rc = object.getValue("type");
7377
if (rc.getName().contains("TestClass")) {

0 commit comments

Comments
 (0)