Frames leak in IE

For the last couple of days I've been working on fixing memory leaks in IE. I'm hosting IE WebBrowser control in a local application (Sider). A lot of different pages are loaded in the application's life-time and memory leak is a serious problem.

I have been fighting this issue in IE for a long time. The best solution would be to force IE control to unload and reload, releasing all memory it's holding, but I'm not sure if this is even possible. I never managed to find a way to do it.

Currently, IE control is always loaded and I have to address the problem at the web page level (and scripts involved). Most common source of the leaks is circular reference between JS and DOM. Often this is caused by anonymous closures and anonymous functions when working with events.

JS libraries (such as Dojo Toolkit) often try to address this issue by acting as a mediator between developer and the browser. They provide a method to register an event handler and clean it up (by breaking circular references) when the page unloads. In many cases this alone is enough to eliminate leaks.

It wasn't in my case. The leaks continued and I had to find a cause (and a solution). In the past I have spent days looking for the exact source of the problem. I knew it was IE-related, but I never could figure it out. I was cleaning everything up, but IE continued to leak.

In this round of me vs. IE I found the cause in about an hour (thanks to Drip). The problem is with frames. For whatever reason I have decided to show several pages together using frames. I found out Dojo causes leaks when it's loaded in a frame. The same page that unloads correctly when shown on its own leads to problems when shown in a frame. I suspect this issue related to how IE unloads frames. I would have never suspected! What's interesting is that Dojo causes a leak even if there're no widgets. For my test I just include dojo.js file on an empty page and leak is already there (only in frames). Strange...

To be fair, I have to say that JSForms has this problem too. Actually it leaks more often than Dojo does. Eliminating memory leaks in IE is not simple at all.

I have added an issue to the Dojo trac (defect ticket). I really do hope the problem can be resolved. Until then I see no other option but not to use frames. Dojo layout manager makes it much easier.



Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: Slava
Posted on: 7/20/2006 at 3:38 PM
Categories: Web development
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Tuesday, January 06, 2009 7:58 AM