22.4 Eliminating Memory Leaks in Internet Explorer with Drip

In the past, web pages have typically used small amounts of memory. This has changed with the recent popularity of dynamic web applications, and especially Ajax-enabled ones. Web pages sometimes use lots of memory while they are open. Even worse, if specific care is not taken, they will continue using that memory after the user has left the page.

A memory leak is a programmer term for a situation when memory has been allocated by a program but is never deallocated. It is not always a critical programming error, at least on client-side applications. Nevertheless, it can be annoying, because the amount of available physical memory is limited. Using too much memory will cause the computer to run more slowly, as the operating system starts swapping memory to the hard drive. In some situations, using too much memory will even cause the program to crash. Long-running server-side applications may cause a completely different set of problems, as they can crash other applications!

The Internet Explorer browser has a peculiarity that can cause it to leak memory. When loading a page, it parses the HTML document and creates a tree of DOM objects, all of which are exposed via a set of Component Object Model (COM) interfaces. Those interfaces are used to access and modify the document from JavaScript and other languages.

The COM system that is built into every modern version of the Windows operating system uses reference-count garbage ...

Get Windows Developer Power Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.