[dojo-contributors] IE7 leaks and testBench

Michael Schall mike.schall at gmail.com
Thu Aug 9 01:05:22 EDT 2007


Sorry, I'm away from my office and can't test this very easily.  If
you aren't seeing the issue, great.  I will test your changes when I
get back at the end of the week.

Thanks

On 8/8/07, Scott J. Miles <sjmiles at turboajax.com> wrote:
> Somehow we are not communicating.
>
> 1. I am using sIEve.
> 2. When I make the modification I proposed to benchTest, the leaks go away.
> 3. When I make a modification to benchTest that attaches the tmp node
> *after* connecting the events, the leaks still go away.
>
> Scott J. Miles
> TurboAjax Group
> http://www.turboajax.com
>
> Michael Schall wrote:
> > A leak is shown using sIEve.  I attached this to the IE7 speed ticket...
> >
> > http://trac.dojotoolkit.org/ticket/4046
> >
> >
> > On 8/8/07, Scott J. Miles <sjmiles at turboajax.com> wrote:
> >> That article describes the classic leak pattern in IE < 7 that has
> >> mostly been fixed in IE7 (and on IE6 with the latest updates). I don't
> >> see any information there specifically relating to IE7.
> >>
> >>  > Note that this leak can occur ANY time a DOM node is created and an
> >>  > event handler is attached to the DOM node before the DOM node is
> >>  > appended to the document.
> >>
> >> My tests indicate that this is not so (again, IE7). As long as the node
> >> ends up as part of the document, the repaired GC in IE7 seems to clean
> >> it up.
> >>
> >> Do you have a test case?
> >>
> >> Regards,
> >> Scott J. Miles
> >> TurboAjax Group
> >> http://www.turboajax.com
> >>
> >> Michael Smith wrote:
> >>> Here's a link to an excellent article detailing this leak pattern in IE.
> >>> To my knowledge, this leak has not yet been fixed in IE7.
> >>>
> >>> http://www.codeproject.com/jscript/LeakPatterns.asp
> >>> <http://www.codeproject.com/jscript/LeakPatterns.asp>
> >>>
> >>> Note that this leak can occur ANY time a DOM node is created and an
> >>> event handler is attached to the DOM node before the DOM node is
> >>> appended to the document. So, this is broader than just the "temp"
> >>> scenario that you describe. It applies to programmatic DOM manipulation
> >>> in general.
> >>>
> >>> To be safe never add an onclick (or any other) event handler to a DOM
> >>> node before it has been appended to the document.
> >>>
> >>> Cheers,
> >>> ~Michael
> >>>
> >>>
> >>> On 8/8/07, * Scott J. Miles* <sjmiles at turboajax.com
> >>> <mailto:sjmiles at turboajax.com>> wrote:
> >>>
> >>>     So, it appears that IE7 still has a basic DOM-JS circular reference leak
> >>>     pattern. The variation in IE7 seems to be that it only occurs when the
> >>>     DOM node is not part of a document.
> >>>
> >>>     We see this problem in spades in testBench because the created widgets
> >>>     are attached to a temp node that is never attached to any document.
> >>>
> >>>     Inserting:
> >>>
> >>>     +65 document.body.appendChild(tmpNode);
> >>>
> >>>     into testBench makes the reported leaks go away (c.f.
> >>>     http://trac.dojotoolkit.org/ticket/3531 and
> >>>     http://trac.dojotoolkit.org/ticket/4046).
> >>>
> >>>     I'm not sure how often this happens in real life, so this may be
> >>>     less of
> >>>     a problem than it appears.
> >>>
> >>>     I would suggest that code that produces phantom nodes (and attaches
> >>>     events to them) should be responsible for making them go away (vs.
> >>>     trying to solve this in event code). Otoh, running the Dijit cleanup
> >>>     code in IE7 could provide a measure of blind protection (with some costs
> >>>     at unload-time).
> >>>
> >>>     I did some basic Googling, but I didn't find any reference to this
> >>>     problem specifically on IE7 (although I seem to be pretty bad at
> >>>     writing
> >>>     Google queries).
> >>>
> >>>     Regards,
> >>>     Scott J. Miles
> >>>     TurboAjax Group
> >>>     http://www.turboajax.com
> >>>     _______________________________________________
> >>>     dojo-contributors mailing list
> >>>     dojo-contributors at dojotoolkit.org
> >>>     <mailto:dojo-contributors at dojotoolkit.org>
> >>>     http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> >>>     <http://dojotoolkit.org/mailman/listinfo/dojo-contributors>
> >>>
> >>>
> >>>
> >>> ------------------------------------------------------------------------
> >>>
> >>> _______________________________________________
> >>> dojo-contributors mailing list
> >>> dojo-contributors at dojotoolkit.org
> >>> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> >> _______________________________________________
> >> dojo-contributors mailing list
> >> dojo-contributors at dojotoolkit.org
> >> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> >>
> > _______________________________________________
> > dojo-contributors mailing list
> > dojo-contributors at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>



More information about the dojo-contributors mailing list