Skip to content
Snippets Groups Projects
Commit e4860005 authored by Goetz Lindenmaier's avatar Goetz Lindenmaier
Browse files

8258734: jdk/jfr/event/oldobject/TestClassLoaderLeak.java failed with...

8258734: jdk/jfr/event/oldobject/TestClassLoaderLeak.java failed with "RuntimeException: Could not find class leak"

Backport-of: aefd4ac4a336f00c067bcb91b95472ccc9a6bf83
parent 49b1ca94
No related merge requests found
......@@ -55,11 +55,14 @@ public class TestClassLoaderLeak {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
TestClassLoader testClassLoader = new TestClassLoader();
for (Class<?> clazz : testClassLoader.loadClasses(OldObjects.MIN_SIZE / 20)) {
for (Class<?> clazz : testClassLoader.loadClasses(OldObjects.MIN_SIZE / 200)) {
// Allocate array to trigger sampling code path for interpreter / c1
for (int i = 0; i < 20; i++) {
for (int i = 0; i < 200; i++) {
Object classArray = Array.newInstance(clazz, 20);
Array.set(classArray, i, clazz.newInstance());
// No need to fill whole array
for (int j = 0; j < 5; j++) {
Array.set(classArray, j, clazz.getConstructors()[0].newInstance());
}
classObjects.add(classArray);
}
}
......@@ -67,6 +70,7 @@ public class TestClassLoaderLeak {
List<RecordedEvent> events = Events.fromRecording(r);
Events.hasEvents(events);
for (RecordedEvent e : events) {
System.out.println(e);
RecordedObject object = e.getValue("object");
RecordedClass rc = object.getValue("type");
if (rc.getName().contains("TestClass")) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment