Reputation: 83
Here is the test URL
http://edventures.com/temp/divtest.php
Procedure:
Is there any way to fix this? Any way to call Garbage collector forcefully without reloading the window?
I am under assumption that when I remove DIV the memory will be freed but does not seem to work that way.
Please let me know any fix to this.
Thanks for your help.
Suhas
Upvotes: 7
Views: 5030
Reputation: 21161
Have you tried this experiment in other browsers? Firefox's memory consumption is much worse than IE's on my machine...
Upvotes: 0
Reputation: 155662
Yeah - IE has some awful memory leaks.
Check out IE Drip - you basically have to design your pages so that they don't do what makes IE leak like this.
This is part of the reason why IE is so loathed.
To avoid IE leaking you have to be very careful with how you add HTML elements to the page, especially tables. Be especially careful with non-HTML 3.2 attributes - IE7 is still basically IE4 and attributes external to the old HTML specs is where it tends to go wrong.
Upvotes: 0
Reputation: 24452
Here's how to create DOM elements and prevent memory leaks in IE.
function createDOMElement(el) {
var el = document.createElement(el);
try {
return el;
}
finally {
el = null;
}
}
You can use variations of the try/finally trick to prevent the leaks when doing other DOM operations.
Upvotes: 10