Re: IE6 memory leak - very fiddly



Daniel Orner wrote:
Thomas 'PointedEars' Lahn wrote:
<snip>

Sigh. [psf 10.1]

You should not simply snip what is being referred to in the quoted text, in
order to preserve the context of what you quoted, of course. (Snipping is
only indicated if what you snipped is not relevant to the reply at all.) If
the target of the reference is too large to be quoted, you should summarize
it or only quote the parts of it that are actually relevant, while marking
omissions. In this case, you should have left in

Even if Prototype was the culprit, however, that still doesn't answer
the question of why the leak doesn't happen when I add that "href"
attribute to the link.

so that

Yes, it would.

would have made sense to the non-regular reader without having to look up
the precursor (that may not be available anymore then).

Prototype.js uses a lot of closures which create circular
references, many of them unnecessary, which are known to leak memory in IE
if host objects (here: DOM objects) are involved (because its GC can't
handle that), and it does not clean up after itself. Adding the `href'
attribute to the `a' element makes it a link in the first place, so that its
corresponding object shows up in the document.links NodeList, for example.

[Read the FAQ Notes. <http://jibbering.com/faq/faq_notes/closures.html#clMem>

[...] I thought that the memory leak happens when a DOM node
has a circular reference to a JavaScript object. You seem to be saying
that when a link is created, it's added to document.links... wouldn't
that then mean that the link would have *more* references than non-links
and hence be *more* likely to leak, rather than stop leaking? Or is
there something I'm not understanding properly?

Chances are that Prototype.js uses document.links or a similar NodeList in a
closure and adds event listeners with scripting. The uncleaned circular
references to the NodeList or an element of that list would leak memory in
IE. That effect could then only be observed if the event target results in
an element of such a NodeList, i.e. if you make that possible by adding the
`href' attribute.

This is nothing but conjecture, of course. Only a look at the source code
can provide a definitive answer.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
.



Relevant Pages

  • Re: IE6 memory leak - very fiddly
    ... references, many of them unnecessary, which are known to leak memory in IE ... DOM objects) are involved (because its GC can't ... I thought that the memory leak happens when a DOM node has a circular reference to a JavaScript object. ...
    (comp.lang.javascript)
  • Re: IE6 memory leak - very fiddly
    ... references, many of them unnecessary, which are known to leak memory in IE ... DOM objects) are involved (because its GC can't ... I thought that the memory leak happens when a DOM node has a circular reference to a JavaScript object. ...
    (comp.lang.javascript)
  • Re: menus in JS or CSS - pros? cons?
    ... So in theory, attaching event handlers to ... The theory that says 'all circular references including DOM nodes causes ... but it does not identify all leak scenarios. ...
    (comp.lang.javascript)
  • Re: A list of cities going farther and farther back into antiquity
    ... that I deal with literary evidence. ... you can do to stop my posting. ... references that don't show any real understanding of the issues ...
    (sci.archaeology)
  • Re: Access to Mainframes via Putty?
    ... in the post you referenced but your "snip" ignored it. ... The references are as follows: ... IBM Communications Server for OS/390 TCP/IP 2000 Update ... it may be the same port but you'll be required to use a different ...
    (bit.listserv.ibm-main)