Jean-Philippe Encausse wrote:
> ...
>
> Does any body know why IE can't garbage collect the Object I bind to a
> DOM Element ?
> Is it a known Memory Leak ?
>
Yes, it is a known memory leak in IE6. IE6 Uses a Windows COM object
(instead of a native JScript garbage collector) to garbage collect IE
and it doesn't garbage collect circular references that are no longer
needed. If a DOMElement-bound object references the element directly or
indirectly, Windows can't clean it up until IE is closed.
|function ClickEventHandler() {
// Reference the element using "this"
}|
|element.expandoClick = ClickEventHandler;
element.attachEvent("onclick", element.expandoClick);
|
Here's a fairly simple explanation of the problem of binding objects to
DOM Elements from the God Father of JavaScript. He also offers some
demonstrations and a function to remedy such leaks.
http://javascript.crockford.com/memory/leak.html
Here's another article with more examples
http://www.bazon.net/mishoo/articles.epl?art_id=824
Here is a more general and dry article from Microsoft discussing JScript
memory leaks. The leak in question is discussed under the "Closures"
heading.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/IETechCol/dnwebgen/ie_leak_patterns.asp
--Ken Snyder
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---