At last a resource that describes exactly how memory leaks occur in IE, written by the only people qualified to know, Microsoft.
“In the past, memory leaks haven’t posed huge problems for Web developers. Pages were kept relatively simple and navigation between different locations within a site was a great way to clean up any loose memory. If there was a leak, it was most likely small enough to go unnoticed.
New Web applications live up to higher standards. A page might run for hours without being navigated and retrieve updated information dynamically through Web services. Language features are pushed to the breaking point by combining complex event schemes, object-oriented JScript, and closures to produce entire applications. With these and other changes, certain memory leak patterns are becoming more prominent, especially those previously hidden by navigation.”
Glad to see that my own mental model of the issue was spot on for the first two patterns so all my current cleanup code seems correct. The last two patterns are new to me; I have never encountered them, but are worth good hard study.
Rather shocked to find out that IE uses COM “reference counting” instead of the modern “mark and sweep” method which is immune to circular references.
I used to believe that the issue was simply a blind-spot in IEs garbage collector with event listeners, but from this article it seems that all circular references that include DOM elements are potentially harmful and the only antidote is effective cleanup code.
Also.. a handy dandy IE leak detector
Try the detector against these testcases