Strange memory leak in IE running local scripts
Monday, April 24, 2006I've been playing with a Prototype based signals & slots implementation I'm making by running it locally and was dismayed at, what I thought was, a huge memory leak problem in IE. I found this article by the legedary Mihai Bazon very helpful in explaining what the IE memory leak problem was all about. But after pairing the code down to next to nothing the leak was still occuring. In fact, it was enourmous. So I made a completely empty page with ony the Prototype library loaded like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script src="prototype.js" type="text/javascript"></script>
</head>
<body>
</body>
</html> But it was still happening locally. Here's what it looked like with the useful Process Explorer after reloading the page many times:

I was bamboozled and disheartened by thinking that Prototype was leaky as hell. That is, until I loaded the files to the server and checked again. This is what I found:

After many, many reloads, no leaks. So what's up with that? The exact same file, leaks horribly when opened locally but is fine when opened remotely???
1 Comment
Actually, it is not the protype javascript file that is leaking memory. It is *any* javascript file.
In fact, I have even done the test with an empty SCRIPT tag (no src, no body) and it still is leaking 4kb with every refresh you make.
There is (again) a serious bug in IE.
By the way, using dynamic script tags created with the DOM will also not help...