"A memory leak occurs in Internet Explorer 6 when you view a Web page that uses JScript scripting on a Windows XP-based computer"
More details are found here.
It's important to note that the fix is only for IE 6.0 running in XP. It doesn't address IE 6.0 running in W2K or IE 5.5. It's also a patch that's applied to the entire OS with a number of other fixes. So, some people ( ex. corporations ) may be hesitant to install it until they've fully verified that the patch is more beneficial than hurtful.
Of course, if you're using IE 7, none of this matters because memory leaks don't occur there anymore.
With these elements in play, I'd thought we'd review memory management in IE.
Since the two memory managers don't communicate with one another they don't know that there are "islands" of circular references which are no longer used. The memory managers get confused and then bad things happen.
Note that I've simplified this a lot. If you want the gory details read Joel Webber's dated but really good description of the issue.
In IE, when memory leaks happen, they don't go away when you navigate to a new page. Instead, the memory loss carries over. If you use a process/memory viewer like Process Explorer, you'll observe this.
The only way to free the memory ( other than breaking the circular references ) is to close and restart the browser.
For events, you do it differently depending on how you've attached the events.
DOM Level 0 Events
It's not optimal to review every event handler to see if a circular reference exists. It's better to just unhook the event handler when you no longer need it.
So, follow this maxim of symmetry - if you add it, remove it.
For DOM Level 0 events, removing it is pretty easy. You nullify it --
var someDiv = document.getElementById("SomeDiv");
someDiv.onclick = null; // Set the handler to null
DOM Level 2 Events
DOM Level 2 event handling supports a number of methods such as addEventListener and removeEventListener. The equivalent methods in IE are attachEvent and detachEvent respectively. We follow the same symmetry with Level 2 events. We add events like this ( with the IE methods ) --
obj.attachEvent( 'onclick', handleClick );
then, we do this to remove them --
A generic way to do this is to use a Singleton object that abstracts how to add or remove events so you don't have to worry about the browser you're using --
It's best to cleanup the events when you "unload" from a page. Listen for the unload event and when that occurs, have your event handler remove the event handlers.
I hope that this is something you can use in your own code.