Leak Demo 1

October 20, 2005

Open Windows Task Manager (Ctrl-Shift-Esc) activate Performance tab and reload (F5) the page a few times. You will see the memory rising.

Click Me!

Code:

function attach()
{
  var element = document.getElementById("my-element");
  element.attachEvent("onclick", function(){ alert("Clicked: " + element.innerHTML); });

  // Make sure we see the leak
  element.bigString = new Array(1000).join(new Array(1000).join("XXXXX"));
}