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

detached Radio(Group) memory leak

XMLWordPrintable

      Steps to Reproduce

      • Run the code
      <zk>
          <div id="root">
              <div id="container">
                  <radiogroup>
                      <radio label="YES"/>
                      <radio label="NO"/>
                  </radiogroup>
              </div>
          </div>
          <button label="detach container" onClick="container.detach();"/>
      </zk>
      
      • click the button
      • perform GC / take a heap dump
      • check the live objects (e.g. in VisualVM)

      Current Result

      The <radio> component remains in memory even though it's been detached from the page

      Expected Result

      All detached components should be eligible for garbage collection.

      Debug Information

      from the heap dump it seems a callback from at the root div keeps a reference to the radio

      the callback is added here:
      https://github.com/zkoss/zk/blob/v9.5.0.2/zul/src/org/zkoss/zul/Radio.java#L289

      Workaround


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

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified