Memory leaks in IE

April 4th, 2008 by Spocke

Oh what pain memory leaks are. Normally these are pretty easy to battle just clean up everything after your self but yesterday I found a new one that produced leaks all over the place.

If you attach an beforeunload event handler to the document it will start leaking in all event handlers even if you make sure to unregister them on page unload so basically if you use beforeunload on the document you are screwed.

It didn’t matter if you unregistered the beforeunload event on unload it just leaked and it only happened when TinyMCE was placed in a frame or iframe oddly enough.

We have been focusing a lot on memory management for TinyMCE the latest couple of days since users tend to do Ajax stuff these days and never leave the page it’s important do remove all references when a editor is removed dynamically from page there are still things to do here but it’s a lot better now.

I guess all browsers leak a bit of memory but on IE the whole browser will get very very slow if it starts to leak. It’s like every DOM API call needs to first loop though the old references before finding target elements.

Posted in Development

One Response

  1. Richard Davies Says:

    I feel your pain, man. I hate having to always jump through hoops just to get IE to cooperate.

    If the memory leaks cause the users too much pain, let them know that’s what they get for using such a crappy browser and urge them to switch to FireFox/Safari/Opera. The world will be a better place for it. :)

    I think as web developers we’re only making matters worse by continually going out of our way in order to make up for IE’s shortcomings. At some point, we’ve got to convince users that they’d be better off with another browser.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.