Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4778

Memory Leak: DesktopEventQueue$ListenerInfo

    XMLWordPrintable

    Details

      Description

      Steps to Reproduce

      run the attachement mvvm-memory-leak.zul
      click the buttons

      1. create
      2. destroy (leak)
      3. check queue listeners

      Current Result

      the DesktopEventQueue is not Idle (means there's still a listener attached to the queue)
      Repeating this causes the memory to grow

      Expected Result

      idle event queue (cleard up listener) after detaching the component

      Debug Information

      The problem happens when a component with a view model is detached after a parent container was detached

      There's still an DesktopEventQueue$ListenerInfo in the _listenerInfos property of DesktopEventQueue

      The listener has a reference to a BinderImpl object which still contains the original component (and subtree) and view model instances.
      This prevents GC causing a memory leak for the lifetime of the desktop.

      Screenshot illustrating the listener and related Binder and components remain in Memory after detaching

      Workaround

      detach the inner component before the container or only detaching the container fixes the problem

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rudyhuang rudyhuang
              Reporter:
              cor3000 cor3000
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 day
                  1d
                  Remaining:
                  Time Spent - 6 hours Remaining Estimate - 2 hours
                  2h
                  Logged:
                  Time Spent - 6 hours Remaining Estimate - 2 hours
                  6h