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

browser memory leak with shadow attribute for overlapped, modal, and highlighted windows

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: 6.5.8
    • Fix Version/s: None
    • Component/s: Components
    • Labels:

      Description

      Shadow is turned on by default. Run this code which generates and closes 50 windows. In Chrome, go into developer tools, >Profiles >Take Heap Snapshot >Take Snapshot. Notice the object count for "Detached DOM tree" is 50. It should be 0. Workaround: set each window's shadow to false, or use my patch (which worked for me).

      test.zul
      <zscript>
        int max=50;
        for (int i=0; i&lt;max; i++) {
          Window w=new Window();
          w.closable=true;
          w.mode="overlapped";
          //w.shadow=false;
          w.left=((int)(Math.random()*800))+"px";
          w.top=((int)(Math.random()*500))+"px";
          w.width=((int)(Math.random()*100))+"px";
          w.height=((int)(Math.random()*100))+"px";
          w.title="window";
          w.border="none";
          w.setPage(page);
          Timer t=new Timer();
          t.setParent(w);
          t.addEventListener(Events.ON_TIMER,new EventListener() {
            onEvent(Event evt) {
              t.detach();
              w.detach();
            }
          });
        }
      </zscript>
      
      patch
      --- a/zk/src/archive/web/js/zk/effect.js
      +++ b/zk/src/archive/web/js/zk/effect.js
      @@ -53,8 +53,8 @@ zk.eff.Shadow = zk.$extends(zk.Object, {
              destroy: function () {
                      jq(this.stackup).remove();
                      jq(this.node).removeClass(this.wgt.getZclass() + '-shadow');
      -               this.wgt = this.node = this.stackup = null;
                      zWatch.unlisten({ onVParent: [this.node, zk.eff._onVParent] });
      +               this.wgt = this.node = this.stackup = null;
              },
              hide: function(){
                      jq(this.stackup).hide();
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            erlen erlen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated: