[Dojo-interest] Memory leaks in Javascript-created widgetsandevent handlers?

Ilia Kantor ilia at dojotoolkit.org
Wed Jan 3 19:32:14 MST 2007


Not sure if it helps, but I tried to cleanup all window properties, and it did 
not help.. =(

Also lots of jointpoints were found in window object out of dojo namespace.

Used this function

=================
function cleanup() {

        for(a in window) {
                if (a=='document' || a=='location') continue;
                try {
                        window[a] = undefined;
                } catch(e) {}

                try {
                        if (window[a].constructor === Function) {
                                window[a] = function() {}
                        }
                } catch(e) {}

        }



     CollectGarbage();
	// reload dojo
        var script=document.createElement('script');
        script.src='dojo.js';
        document.getElementsByTagName('head')[0].appendChild(script);
        dojo.require("dojo.widget.Button");

}
===============


> On Wednesday 03 January 2007 1:12 am, Martin Kou wrote:
> > Here's a video of what happend, notice the VM size was increasing
> > rapidly as I clicked create and destroy. This is incorrect behavior
> > since the VM size indicates the virtual memory address space
> > allocated to the browser.
> >
> > http://hkpcug.homeftp.net/~francium/leak_demo.swf.html
> >
> > (2.1MB video warning)
>
> Just to be very clear, unless I'm seeing the video wrong, what you're
> describing is increasing memory usage *in a single page*. Leakage, as
> is usually defined WRT MSIE, is defined by un-recovered memory across
> page loads, not an increase in memory footprint inside the same page
> environment.
>
> We may be able to do something about the later, but we've spend our time
> dealing with the former to date, as it has truly debilitating
> consequences for long-term usage.
>
> Regards
>
> > In the video I've minimized the IE window once and restored it to
> > demonstrate the "Mem usage" column (the working set size) is highly
> > volatile and cannot be used for memory leak evaluation (there seems
> > to be nothing wrong if you only look at the mem usage column).
> >
> > ----- Original Message -----
> > From: "Jayaram" <jkrishnaswamy at comcast.net>
> > To: <dojo-interest at dojotoolkit.org>
> > Sent: Wednesday, January 03, 2007 4:21 AM
> > Subject: Re: [Dojo-interest] Memory leaks in Javascript-created
> > widgetsandevent handlers?
> >
> > >I used your code to test your complaint, but I did not observe
> > > anything unusual.  Could you quantify waht you are saying? Your
> > > create and estroy worked without any problem.  The  destroy
> > > destoyed items created repeatedly all at once. I am intereseted in
> > > knowing waht yous aw in the Windows Task Manager window. The event
> > > handlers also worked for each of the Hello World!.
> > >
> > > Jayaram
> > > ----- Original Message -----
> > > From: "Martin Kou" <bitanarch at gmail.com>
> > > To: <dojo-interest at dojotoolkit.org>
> > > Sent: Sunday, December 31, 2006 4:56 AM
> > > Subject: [Dojo-interest] Memory leaks in Javascript-created widgets
> > > andevent handlers?
> > >
> > >> Hi,
> > >>
> > >> I'm new to Dojo Toolkit - I've just started learning it last week.
> > >> I started
> > >> learning it by writing some simple, proof-of-concept dynamic pages
> > >> (where widgets can be created and destoryed without being
> > >> refreshed - I haven't touched on the ajax stuff yet). I think I've
> > >> done something wrong, and I've
> > >> tried things like dojo.event.browser.clean() that popped up in
> > >> this mailing
> > >> list and Alex's December 2005 blog entries for similar problems,
> > >> but to no
> > >> avail.
> > >>
> > >> First page I constructed with Dojo:
> > >> http://hkpcug.homeftp.net/~francium/dojo-0.4.1-ajax/dojo_leak_dom.
> > >>html
> > >>
> > >> Second page I constructed with Dojo:
> > >> http://hkpcug.homeftp.net/~francium/dojo-0.4.1-ajax/dojo_leak_widg
> > >>et.html
> > >>
> > >> Notice that the links might be very slow or even unreachable,
> > >> because my server is located in Hong Kong, and the international
> > >> links from here are damaged right now due to last week's
> > >> earthquake in Taiwan. For this reason,
> > >> I've attached the .html file to my post as well.
> > >>
> > >> In both examples, clicking "Creating xxx widgets" and then
> > >> "Destroy All" repeatedly in IE6 or IE7 would lead to the vmsizes
> > >> of both browsers (as observed from Window's Task Manager) increase
> > >> rapidly. How can I correct this problem? And could anyone kindly
> > >> point to the reason why is it happening?
> > >>
> > >> Best Regards,
> > >> Martin Kou
> > >
> > > -------------------------------------------------------------------
> > >-------------
> > >
> > >> _______________________________________________
> > >> Dojo FAQ: http://dojo.jot.com/FAQ
> > >> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> > >> Dojo-interest at dojotoolkit.org
> > >> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> > >
> > > -------------------------------------------------------------------
> > >-------------
> > >
> > >
> > > No virus found in this incoming message.
> > > Checked by AVG Free Edition.
> > > Version: 7.1.409 / Virus Database: 268.16.1/611 - Release Date:
> > > 12/31/2006
> > >
> > > _______________________________________________
> > > Dojo FAQ: http://dojo.jot.com/FAQ
> > > Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> > > Dojo-interest at dojotoolkit.org
> > > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> > _______________________________________________
> > Dojo FAQ: http://dojo.jot.com/FAQ
> > Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> > Dojo-interest at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest


More information about the Dojo-interest mailing list