[Dojo-interest] dynamic Textboxes: why does the following snippet leak memory on IE7 ?

stefan.hansel at tolina.de stefan.hansel at tolina.de
Wed Aug 13 11:06:41 UTC 2008


I played around a bit with dynamically creating/destroying Textboxes.
Unfortunataly I produced a memory leak in IE7 and don't know how to fix this. No listener or anything else is involved.

I just create 100 TextBoxes and then destroy them again, and then repeat this sequence, see the code above.
If you ran this snippet in IE7, than slowly memory increases and never drops (trying the same with google-web-toolkit I get a constant memory size)

I thought that maybe the created 'div' per TextBox is the problem, on the other hand I looked into 'destroyRecursive' and it looks to me, as if this 'div' is destroyed by
dojo ?

Can anyone spot, where the problem is ?

Kind Regards,

Stefan


--------------- code ------
<html>
<head>
<title>Dojo: Textboxtest!</title>

<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.0.0/dojo/dojo.xd.js"></script>
<script type="text/javascript"><!--
  dojo.require("dijit.form.TextBox");
  dojo.addOnLoad( refresh )

  var offset=0;
  var map=new Array();

  function refresh() {
    for ( var int = 0; int < 100; int++) {
      if (map[int]) {
        map[int].destroyRecursive(false);
        map[int]=null
        delete map[int];
      }

      // create a div for textbox
      var placeHolder = document.createElement("div");
      dojo.byId("someDiv").appendChild(placeHolder);

      var textbox = new dijit.form.TextBox( {}, placeHolder);
      textbox.textbox.value= offset +"Test Test Test Test Test Test Test" ;

      // keep widget for later destroy
      map[int]=textbox;
      placeHolder=null;
      textbox=null;
      offset++;
    }
    // triger next update
    window.setTimeout(refresh, 200);
  }

    --></script>
</head>

<body>
<div id="someDiv" />
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://turtle.dojotoolkit.org/pipermail/dojo-interest/attachments/20080813/77b82d92/attachment-0001.html 


More information about the Dojo-interest mailing list