Hi,

Can you help me spot what is causing the memory leak in the following code?

If I click "reload", "bind", and "clean" several times, the memory
allocation for IE stays still.
But if I click in the "reload & bind" and then "clean", several times, the
memory allocation keeps climbing.

I appreciate any feedback you may have.

Thanks,
Ethan

=================================================================
<html>
<head>
<script type="text/javascript" src="jquery-1.0.3.js"></script>
<meta http-equiv="content-type" content="text/html" />
<title>IE Memory Leak</title>
</head>
<body>

<button id="reload">reload</button><br>
<button id="bind">bind</button><br><br>

<button id="reloadnbind">reload & bind</button><br><br>

<button id="clean">clean!</button><br>

<div id="container" style="border:1px solid red"></div>
<div id="counter" style="border:1px solid green"></div>

<script type="text/javascript">
  var counter = 1;

  function reload(callback){
    $("#container").load("template.html", callback);
  }

  function bind(){
    var p = $(this).find("p");
    p.click(function(){});
    p.get(0).bigString = new Array(1000).join(new
Array(1000).join("XXXXX"));

    $("#counter").html(counter++);
  }

  $("#reload").click(reload);
  $("#bind").click(bind);
  $("#reloadnbind").click(function(){
    reload(bind);
  });

  $("#clean").click(function(){
    var p = $("#container").find("p");
    p.unbind();
    p.get(0).onclick = null;

    $("#container").html("");
  });
</script>
</body>
</html>
-- 
View this message in context: 
http://www.nabble.com/Memory-leak-tf2792655.html#a7791251
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to