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

Memory Leak: event handlers of root TreeItem are not removed

XMLWordPrintable

      TreeViewMemTest (attached) run in static mode and 16mb of heap fails with OOM after ~65,000 iterations.
      The reason is because event handlers reachable from root TreeItem are not removed.
      As results there are more than 262,000 WeakEventHandlers which occupy more than 12Mb.
      See full root path in attached TreeView_heap.jpg.

      The test just creates new TreeView object with 31 static TreeItems (created at the beginning of the test)
      on each pulse. TreeView object created on previous pulse is removed before new one is created.
      So, only one TreeView object exists at any moment of time.

      Steps to run the test:
      > java -Xmx16m -verbose:gc -XX:+HeapDumpOnOutOfMemoryError -cp "..." TreeViewMemTest -mode static

      There is no such memory issue in case the test is run in dynamic mode (-mode dynamic).

        1. rt16529.patch
          4 kB
        2. TreeView_heap.JPG
          TreeView_heap.JPG
          270 kB
        3. TreeViewMemTest.java
          5 kB

            jgiles Jonathan Giles
            epavlova Ekaterina Pavlova
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: