mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8316193: jdk/jfr/event/oldobject/TestListenerLeak.java java.lang.Exception: Could not find leak
Backport-of: f6be922952
This commit is contained in:
committed by
Vitaly Provodin
parent
8d92a40389
commit
e785eded1c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -71,15 +71,17 @@ public class TestListenerLeak {
|
||||
|
||||
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();
|
||||
listenerLeak();
|
||||
r.stop();
|
||||
List<RecordedEvent> events = Events.fromRecording(r);
|
||||
if (OldObjects.countMatchingEvents(events, Stuff[].class, null, null, -1, "listenerLeak") == 0) {
|
||||
throw new Exception("Could not find leak with " + Stuff[].class);
|
||||
while (true) {
|
||||
try (Recording r = new Recording()) {
|
||||
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff", "infinity");
|
||||
r.start();
|
||||
listenerLeak();
|
||||
r.stop();
|
||||
List<RecordedEvent> events = Events.fromRecording(r);
|
||||
if (OldObjects.countMatchingEvents(events, Stuff[].class, null, null, -1, "listenerLeak") != 0) {
|
||||
return; // Success
|
||||
}
|
||||
System.out.println("Could not find leak with " + Stuff[].class + ". Retrying.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user