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

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

<p>But if I have a very huge application, where should a start from?</p>

[{'answer_id': 19784, 'author': 'Dave Ward', 'author_id': 60, 'author_profile': 'https://Stackoverflow.com/users/60', 'pm_score': 4, 'selected': True, 'text': '<p>Check out <a href="http://sourceforge.net/projects/ieleak" rel="nofollow noreferrer">Drip</a>.  That usually takes the guesswork out of IE memory leaks.</p>\n\n<p>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.</p>\n\n<p>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.</p>\n'}, {'answer_id': 19794, 'author': 'John Topley', 'author_id': 1450, 'author_profile': 'https://Stackoverflow.com/users/1450', 'pm_score': 1, 'selected': False, 'text': '<p>Does the application use a lot of JavaScript?</p>\n\n<p>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.</p>\n\n<ul>\n<li>IE6 can also leak memory if you have <a href="http://support.microsoft.com/kb/830555/" rel="nofollow noreferrer">circular references to DOM objects</a></li>\n<li>Also try this <a href="http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx" rel="nofollow noreferrer">JavaScript Memory Leak Detector</a> and see if you can diagnose where the problem is</li>\n</ul>\n'}, {'answer_id': 9519996, 'author': "Trident D'Gao", 'author_id': 139667, 'author_profile': 'https://Stackoverflow.com/users/139667', 'pm_score': 0, 'selected': False, 'text': '<p>Here is how I solved the memory leak problem in IE7. The idea is to dispose/set to null all expando-properties on all DOM nodes at unloading the page. This worked for me. You may find it useful.</p>\n\n<pre><code>&lt;!--[if lt IE 8]&gt;\n&lt;script type="text/javascript"&gt;\n\nfunction disposeAll() {\n    if (window.document.all) {\n        for (var index = 0; index &lt; window.document.all.length; index++) {\n            try { dispose(window.document.all[index], []); } catch (e) { debugger; }\n        }\n    }\n    dispose(window.document.body, []);\n    dispose(window.document, []);\n    dispose(window, []);\n    window.disposeAll = null;\n    window.dispose = null;\n    window.onunload = null;\n}\n\nfunction dispose(something, map) {\n    if (something == null) return;\n    if (something.dispose &amp;&amp; typeof (something.dispose) == \'function\') {\n        try { something.dispose(); } catch (e) { debugger; }\n    }\n    map.push(something);\n    for (var key in something) {\n        var value = null;\n        try { value = something[key]; } catch (e) { };\n        if (value == null || value == dispose || value == disposeAll) continue;\n\n        var processed = null;\n        for (var index = 0; index &lt; map.length; index++) {\n            if (map[index] === value) {\n                processed = value;\n                break;\n            }\n        }\n        if (processed != null) continue;\n        var constructor = value.constructor;\n        if (constructor == Object || constructor == Array) {\n            try { dispose(value, map); } catch (e) { debugger; }\n        }\n        if (constructor == Object || constructor == Array || constructor == Function) {\n            try { something[key] = null; } catch (e) { debugger; }\n        }\n    }\n    map.pop();\n}\n\n(function() {\n    var previousUnloadHandler = window.onunload;\n    if (previousUnloadHandler == null) {\n        window.onunload = disposeAll;\n    } else {\n        window.onunload = function() {\n            previousUnloadHandler.apply(this, arguments); // &lt;== HERE YOU MAY WANT TO HAVE AN "IF" TO MAKE SURE THE ORIGINAL UNLOAD EVENT WASN\'T CANCELLED\n            disposeAll();\n            previousUnloadHandler = null;\n        };\n    }\n}());\n\n&lt;/script&gt;\n&lt;![endif]--&gt;\n</code></pre>\n\n<p>You may want to remove all "debugger;" statements if you don\'t feel like dealing with some occasional exceptions.</p>\n'}]
['https://Stackoverflow.com/questions/19773', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1100/']