Skip to content

Commit e486000

Browse files
committed
8258734: jdk/jfr/event/oldobject/TestClassLoaderLeak.java failed with "RuntimeException: Could not find class leak"
Backport-of: aefd4ac4a336f00c067bcb91b95472ccc9a6bf83
1 parent 49b1ca9 commit e486000

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
@@ -55,18 +55,22 @@ public static void main(String[] args) throws Exception {
5555
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
5656
r.start();
5757
TestClassLoader testClassLoader = new TestClassLoader();
58-
for (Class<?> clazz : testClassLoader.loadClasses(OldObjects.MIN_SIZE / 20)) {
58+
for (Class<?> clazz : testClassLoader.loadClasses(OldObjects.MIN_SIZE / 200)) {
5959
// Allocate array to trigger sampling code path for interpreter / c1
60-
for (int i = 0; i < 20; i++) {
60+
for (int i = 0; i < 200; i++) {
6161
Object classArray = Array.newInstance(clazz, 20);
62-
Array.set(classArray, i, clazz.newInstance());
62+
// No need to fill whole array
63+
for (int j = 0; j < 5; j++) {
64+
Array.set(classArray, j, clazz.getConstructors()[0].newInstance());
65+
}
6366
classObjects.add(classArray);
6467
}
6568
}
6669
r.stop();
6770
List<RecordedEvent> events = Events.fromRecording(r);
6871
Events.hasEvents(events);
6972
for (RecordedEvent e : events) {
73+
System.out.println(e);
7074
RecordedObject object = e.getValue("object");
7175
RecordedClass rc = object.getValue("type");
7276
if (rc.getName().contains("TestClass")) {

0 commit comments

Comments
 (0)