On Tue, 2010-12-07 at 07:49 -0800, David Flanagan wrote:
> My understand is that this pattern of leaks was always IE-specific and 
> has been (at least mostly) fixed in IE7.

Specifically: the leak has been mitigated in IE7, and the same
mitigation has been backported to IE6 through a patch you can expect
everyone to have nowadays (it was around SV1 time if I remember
correctly).

What happens is that when you unload a page, all the JS objects
associated with that page are destroyed. This means the memory leak only
builds up until you navigate the page, instead of for the entire life of
the iexplore.exe process. (It also has some tricky consequences for
cross-window sharing of non-primitive JS values.)

So if you have a long-running webapp page and users with IE6-7, you
still have a problem. Otherwise, you can probably forget about it unless
you're doing something really pathological.

The leak does still exist in IE8: as before, any time you have a
reference cycle between a native-JS object and a host object, they
become un-GC-able. However, when you use IE8 Standards Mode, all your
DOM nodes become native objects instead of host objects, so this kind of
refcycle becomes much less likely to happen. The common case of [DOM
node -> event handler -> closure -> DOM node] is now safe.

You can still have a host-object<>native-object refcycle in IE8 if you
can get your hands on a host object, such as an `ActiveXObject`. So:
always use `new XMLHttpRequest` where available, only using the ActiveX
version as a fallback for IE6.

-- 
And Clover
mailto:[email protected] http://www.doxdesk.com
skype:uknrbobince gtalk:[email protected]



_______________________________________________
JSMentors mailing list
[email protected]
http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com

Reply via email to