Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8242501: JFR: oldobject/TestG1.java can't find leaking object
Reviewed-by: mgronlun
  • Loading branch information
egahlin committed Jun 24, 2020
1 parent 2ad6386 commit 362f168d2324b862e20de9084e6ce30dfd6b2d62
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 30 deletions.
@@ -54,17 +54,21 @@ static private class FindMe {
public static void main(String[] args) throws Exception {
WhiteBox.setWriteAllObjectSamples(true);

try (Recording r = new Recording()) {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
allocateFindMe();
System.gc();
r.stop();
List<RecordedEvent> events = Events.fromRecording(r);
System.out.println(events);
if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") == 0) {
throw new Exception("Could not find leak with " + FindMe[].class);
while (true) {
try (Recording r = new Recording()) {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
allocateFindMe();
System.gc();
r.stop();
List<RecordedEvent> events = Events.fromRecording(r);
System.out.println(events);
if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") > 0) {
return;
}
System.out.println("Could not find leaking object, retrying...");
}
list.clear();
}
}

@@ -54,17 +54,21 @@ static private class FindMe {
public static void main(String[] args) throws Exception {
WhiteBox.setWriteAllObjectSamples(true);

try (Recording r = new Recording()) {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
allocateFindMe();
System.gc();
r.stop();
List<RecordedEvent> events = Events.fromRecording(r);
System.out.println(events);
if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") == 0) {
throw new Exception("Could not find leak with " + FindMe[].class);
while (true) {
try (Recording r = new Recording()) {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
allocateFindMe();
System.gc();
r.stop();
List<RecordedEvent> events = Events.fromRecording(r);
System.out.println(events);
if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") > 0) {
return;
}
System.out.println("Could not find leaking object, retrying...");
}
list.clear();
}
}

@@ -54,17 +54,21 @@ static private class FindMe {
public static void main(String[] args) throws Exception {
WhiteBox.setWriteAllObjectSamples(true);

try (Recording r = new Recording()) {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
allocateFindMe();
System.gc();
r.stop();
List<RecordedEvent> events = Events.fromRecording(r);
System.out.println(events);
if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") == 0) {
throw new Exception("Could not find leak with " + FindMe[].class);
while (true) {
try (Recording r = new Recording()) {
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
r.start();
allocateFindMe();
System.gc();
r.stop();
List<RecordedEvent> events = Events.fromRecording(r);
System.out.println(events);
if (OldObjects.countMatchingEvents(events, FindMe[].class, null, null, -1, "allocateFindMe") > 0) {
return;
}
System.out.println("Could not find leaking object, retrying...");
}
list.clear();
}
}

0 comments on commit 362f168

Please sign in to comment.