Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8257906

JFR: RecordingStream leaks memory

    XMLWordPrintable

Details

    • jfr
    • b31

    Backports

      Description

        From mailing list. The following code provokes a memory leak:

        import jdk.jfr.consumer.RecordingStream;

        public class RecordingStreamTest {

        public static byte[] bytes;

        public static void main(String[] args) throws Exception {
        RecordingStream stream = new RecordingStream();
        stream.enable("jdk.ObjectAllocationInNewTLAB");
        stream.enable("jdk.ObjectAllocationOutsideTLAB");
        stream.onEvent(re -> {});
        stream.startAsync();

        for (int j = 1; j <= 5; j++) {
        for (int i = 1; i <= 100_000_000; i++) {
        bytes = new byte[1024];
        }

        System.gc();
        }

        stream.close();
        stream.awaitTermination();

        System.gc();

        Thread.sleep(5000);
        }
        }

        Attachments

          Issue Links

            Activity

              People

                egahlin Erik Gahlin
                egahlin Erik Gahlin
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: