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

Memory leak in ListView: listeners are not removed

XMLWordPrintable

      ListViewMemTest (attached) run in static mode and 16mb of heap fails with OOM after ~18,000 iterations.
      The reason is because listeners are not removed.
      staticListViewData -> observers -> elementData array has 297,868 elements (WeakListChangeListener)
      at the time the test fails with OOM. See attached ListView_heap.jpg as well.

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

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

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



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

              Created:
              Updated:
              Resolved:
              Imported: