title: Is it possible to use iframes in IE without memory leaks?
body: <p>All versions of IE (including 10) appear to hold on to a significant amount of memory allocated by iframes until window.top.unload occurs. This creates quite the challenge for long-lived pages that may create a number of iframes throughout their lifetime. A simplified example of the problem can be found here:</p>
  
  <p><a href="http://pastebin.com/FmZ7iMHB" rel="noreferrer">http://pastebin.com/FmZ7iMHB</a></p>
  
  <p>That example uses a Wikipedia page for the iframe to magnify the problem, but even a simple page with a single image will leak.</p>
  
  <p>In a nutshell, after you destroy an iframe in IE you get some but not all of the memory back the next time a page triggers a garbage collection (typically about 25% of the memory used by the iframe gets stuck in limbo). Refreshing or navigating to a new page (window.top.unload) will free up most or all of the remaining memory.</p>
  
  <p>This particular leak is not detectable in tools like <a href="http://home.orange.nl/jsrosman/" rel="noreferrer">sIEve</a> and Microsoft's <a href="http://blogs.msdn.com/b/gpde/archive/2009/08/03/javascript-memory-leak-detector-v2.aspx" rel="noreferrer">JS Memory Leak Detector</a>. I've read everything I can find about leaky iframes in IE, but have had no luck with the solutions I've come across.</p>
  
  <p>Does anyone know a solution or workaround to this problem? The only mitigation strategy I have is to do as much cleanup as you can from within the iframe before the parent page destroys it, but that doesn't help when you don't control the page being framed in.</p>