mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8242501: JFR: oldobject/TestG1.java can't find leaking object
Reviewed-by: mgronlun
This commit is contained in:
parent
2ad638621c
commit
362f168d23
@ -54,17 +54,21 @@ public class TestG1 {
|
||||
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 @@ public class TestParallel {
|
||||
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 @@ public class TestSerial {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user