stefan.hansel | 13 Aug 13:05
Favicon

dynamic Textboxes: why does the following snippet leak memory on IE7 ?

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>

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest <at> dojotoolkit.org
http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest

Gmane