IE6's main memory leak hot-fixed

I just learned through Ajaxian that IE6's main memory leak has been hot-fixed two weeks ago through Windows Update.

So what does that mean for Ajax developers? Well, it becomes a little less important to dispose of any circular references you may have in your code: when the user navigates away from the page, that memory will now be freed.

But if your users are going to stay on the same page for a while, and objects are going to be created and destroyed frequently, the memory occupation of your application is still going to raise steadily if you don't properly dispose of those circular references. For example, the following code still leaks on IE6 and 7:

function createDiv() {
  var d = document.createElement("DIV");
  d.expando = function() {
  }
  window.setTimeout(createDiv, 5);
}

window.setTimeout(createDiv, 5);

The same code on Firefox 2, Safari 3 and Opera 9 shows stable memory occupation after warmup.

So in a nutshell, it's good that this got fixed (kind of), but it really doesn't change anything for Ajax developers: it's still important to dispose of event handlers and other expandos as you destroy objects and DOM elements.

2 Comments

  • hi,
    thx for this article . but can i get a solution for it.
    i am completely using ajax on my web site and its tending to slow my website

  • @Shankar: just clean after yourself. If you're using building Microsoft Ajax, that means implementing dispose on all your components. In general, avoid capturing elements in closures. The above example can be cleaned by deleting the expando on the element.

Comments have been disabled for this content.