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

FormIdCache in AnnotateBinderEx causing memory leak with shadow elements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.6.0
    • 9.5.0.3
    • Databind 2
    • Security Level: Jimmy

      Steps to Reproduce

      run the attached example

      switch the type from A to B and back to A ... repeat

      the same is simulated in the attached ZATS test case

      Current Result

      the cache size is growing, containing several detached shadow elements as keys referencing NULL values

      The Zats case will fail assertions for detached components and NULL values in the cache.
      Also it logs the cache contents and size history

      {<Choose>=null, <Div n2qY1>=fx, <Choose@0 (<Div n2qYf>)>=null}
      {<Choose>=null, <Div n2qY1>=fx, <Choose>=null, <Choose@0 (<Div n2qY7>)>=null}
      {<Choose>=null, <Div n2qY1>=fx, <Choose>=null, <Choose>=null, <Choose@0 (<Div n2qYf>)>=null}
      ...
      [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
      

      Expected Result

      no growing cache size, stale values need to be cleaned up

      in more detail:

      • no NULL values in the cache
      • no detached components/shadow elements in the cache

       

      A WeakHashMap may help to cleanup detached components and allow garbage collection. 

      Debug Information

      NULL values should not be put in the cache in the first, place ... there's no point, a missing key will just return null as well (nothing in the code is checking for containsKey, only get/put are used)
      Currently nothing is ever removed from the cache.

      maybe the algorithm iterating over the parents (to find the surrounding form) fails for shadow elements

      Workaround

            Leon03 Leon03
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: