Thursday, December 29, 2005
by
Vassil Terziev
|
Go comment!
As I have mentioned earlier (see "To leak, or not to leak…(memory) – Part One") the closures are the most common reason for memory leaks in Internet Explorer.
They are extremely good at forming circular references especially in the context of Host objects. The most common example is event handlers “owned” by a Native object which are attached to a specific event raised by a DOM element and hold a reference to that DOM object kept in the Native object.
Example:
DOMElement.Event -> NativeObject.EventHandler -> current execution context scope ->
NativeObject. DOMElementRefference -> DOMElement
Very frequently websites and web applications with a rich UI include components which produce...