DwarfParser resource leak

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: 17, 21
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: