views:

930

answers:

4

I have a huge web app that is having issues with memory leak in IE 6.

Fixing a memory leak in a 5 line code sample that demonstrates the problem is easy.

But if I have a very huge application, where should a start from?

+6  A: 

Check out Drip. That usually takes the guesswork out of IE memory leaks.

If for some reason Drip doesn't find it, take a close look at any JavaScript code that works with events. That is almost always the source of any significant memory leak in a browser.

Destroying a DOM element with handlers attached to it, without removing those handlers first, will prevent the memory associated with those handlers from being recovered.

Dave Ward
A: 

Can you give some more details about this "huge web app"? Are you using AJAX? Any javascript frameworks? Maybe the site is live and you can give us an URL?

Do you have the same issues with users running IE7?

Here are some general links talking about varius memory leak problems in IE6:

- Link 1 (ie6memoryleak_fix)
- Link 2 (is-finally-the-answer-to-all-ie6-memory-leak-issues)
- Link 3 (javascript-memory-leak-detector)

Espo
+1  A: 

Does the application use a lot of JavaScript?

If it does, then one thing I've found that helps for avoiding memory leaks is to make sure you're using a JavaScript framework such as Prototype or jQuery because they have tried and tested event-handling code that doesn't leak memory.

John Topley
A: 

You're leaking memory from Java functions?

Here's a solution: Take your homebrew java and chuck it. Use one of the standard javascript frameworks, such as jQuery.

If you're doing complex javascript and aren't a java guru, don't do it yourself.

Edit: What, is that bad advice? Javascript isn't just a simple scripting language; its a complex and surprisingly powerful programming language that is closely linked to the HTML DOM, which is implemented differently in different browsers. If you do it wrong, you will not only leak memory but also throw errors everywhere and generally make the browsing experience awful. Do you want to drive away the people coming to your website? No? Then use a javascript framework and get rid of all your hacky cross-browser bullshittery.

Will
I didn't mod you down but jQuery itself has memory leaks in some cases, along with the jQuery UI. At least with the 1.3.2 version...
rball