[Dojo-interest] Memory leaks in Javascript-created widgetsandevent
handlers?
mengel at notes.cc.sunysb.edu
mengel at notes.cc.sunysb.edu
Wed Jan 3 06:37:38 MST 2007
I've run into a similar problem with my pages that contain many widgets. I
don't have a solution yet, as we are still in development with our
project, I haven't made it a major concern. I figured it was just
something stupid that I was doing, and that if it were a problem with
Dojo, someone else would eventually have the same issue. There have been
occasional reports of memory leak problems, but usually they're just
shrugged off. I feel, however that there is definitely something lurking
out there.
One thing I've found. I've timed my functions and it seems the create
time increases exponentially each time the function is called. Your video
seems to show the same thing, however I haven't run your code on my
machine to test. It seems as though a list is being searched, and added
to each time the function is called.
As for a solution, I don't have a complete one, but I've learned to set
all variables to null before they lose scope. IE does not handle garbage
like that well. Try this for the widget and node variables in the
createOne and destroyAll functions and see if it helps.
Thanks,
Matthew Engel
Senior Programmer/Analyst
State University of New York at Stony Brook
mengel at notes.cc.sunysb.edu
"Martin Kou" <bitanarch at gmail.com>
Sent by: dojo-interest-bounces at dojotoolkit.org
01/03/2007 04:12 AM
Please respond to
dojo-interest at dojotoolkit.org
To
<dojo-interest at dojotoolkit.org>
cc
Subject
Re: [Dojo-interest] Memory leaks in Javascript-created widgetsandevent
handlers?
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)
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_widget.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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070103/fe7188a4/attachment.html
More information about the Dojo-interest
mailing list