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

memory leak (during desktop lifetime) with method binding

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.1
    • 8.5.2
    • Databind 2
    • Security Level: Jimmy
    • None
    • ZK 8.6.0 S1, ZK 8.6.0 S2, ZK 8.6.1 S1

      Steps to Reproduce

      Certain data bindings cause a memory leak during the lifetime of a desktop if templates are re-rendered from a listmodel with template e.g. in <listbox> or <forEach> component.

      run the attached example method-binding-leak.zul
      1) take a heap dump to count the number of TrackerNodeImplEx-instances
      2) click the button to replace objects in the model
      3) take another heap dump to compare the number of instances
      repeat (2,3)

      4) eventually reload screen to destroy the desktop

      Current Result

      number of instances before: TrackerNodeImplEx 22
      number of instances after 1st click: TrackerNodeImplEx 26
      number of instances after 2nd: TrackerNodeImplEx 30
      number of instances after 3nd: TrackerNodeImplEx 34
      ...
      number of instances after reload: TrackerNodeImplEx 22

      Expected Result

      constant number of TrackerNodeImplEx instances

      Debug Info

      The attachment contains several workarounds that don't have this problem.
      The combination of @load(vm.model) and an EL containing a method call @load(vm.getTitleForItem(each)) cause this memory leak during the lifetime of a desktop. After a desktop cleanup the leaked memory gets GCed again.

      Workaround

      bind the model using @init(vm.model) or avoid method calls in EL expressions and rely on bean properties @load(each.property) inside the template.

            DevChu DevChu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: