-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Normal
-
Affects Version/s: 8.5.2
-
Component/s: Databind 2
-
Security Level: Jimmy
-
None
-
ZK 8.6.0 S1, ZK 8.6.0 S2, ZK 8.6.1 S1
-
None
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.