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

DwarfParser resource leak

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 17, 21
    • hotspot
    • b06

      DwarfParser class creates a cleaner using this code:
      https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java#L51-L52

          Cleaner.create()
                 .register(this, () -> DwarfParser.destroyDwarfContext(p_dwarf_context));

      There are 2 problems with this:
      - each new DwarfParser creates a new Cleaner instance. Each cleaner instance has an associated thread, so with a large number of live instances, the number of threads might hit the platform thread limit.
      - the created lambda captures the enclosing instance, which in turn means that it will never be eligible for collection, and the cleaner will never run.

            djelinski Daniel Jelinski
            djelinski Daniel Jelinski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: