Thanks for the response Henry. I was wondering myself if pseudo-leaks
were being misreported, but I didn't get chance today to test this
outside of Drip.

I'll see if I can reproduce this outside Drip using TaskManager and if
I can still reproduce, I'll post a new thread with a test case and
more details.




On Apr 22, 1:47 pm, Henry <rcornf...@raindrop.co.uk> wrote:
> On Apr 22, 9:01 am, Danny Tuppeny wrote:
>
>
>
>
>
> > Here's a small sample page that seems to leak in the same
> > way as jQuery:
>
> > <html><head><script type="text/javascript">
> > function leakMe() {
> >         var div = document.createElement("div");
> >         document.body.appendChild(div);
> >         document.body.removeChild(div);}
>
> > </script></head><body onload="leakMe();"></body></html>
>
> > The docs for Drip say that removeChild is just a psuedo-leak
> > and will be cleaned up when the page is unloaded, but that
> > doesn't happen. If you set the above page to Auto-refresh
> > in Drip, memory usage just goes up and up forever. If you
> > can find a way to stop that happening in the small sample,
> > I suspect fixing jQuery will be easy.
>
> There is a problem here but I suspect that problem is with Drip and
> not IE or JQuerry (there may be problems with IE and/or JQuery but if
> so they are not being demonstrated here).
>
> Starting with the following more extreme example of the - appendChild
> -, - removeChild - sequence; appending 100,000 DIVs, stopping with an
> - alert - (to give the opportunity for garbage collection to run and
> memory use to be examined), removing all of those DIVs from the DOM,
> stopping again, and then repeating/looping the process, should, if the
> memory leak issue exists (in relation to - removeChild - use) result
> in ever increasing memory consumption, which should be noticeable
> using crude examination techniques (such as reading the iexplorer
> process's "Mem Usage" in Task Manage) due to the number of DIVs
> created. However, using this test page:-
>
> <html>
> <head>
>      <title></title>
>      <style type="text/css">
>      </style>
> </head>
> <body>
> <script type='text/javascript'>
> function createDivs(){
>   var div;
>   for(var c = 0;c < 100000;++c){
>     div = document.createElement('DIV');
>     document.body.appendChild(div);
>   }
>   alert('Divs set');
>   setTimeout(clearDom, 3000);
>
> }
>
> window.onload = createDivs;
>
> function clearDom(){
>   while(document.body.lastChild){
>     document.body.removeChild(document.body.lastChild);
>   }
>   alert('Divs cleared');
>   setTimeout(createDivs, 3000);}
>
> </script>
> </body>
> </html>
>
> (The 3 second delay between function calls is to give you time to
> close the browser when enough has been seen)
>
> - running in IE 6 (on XP) gives an oscillating (by about 9 megabytes)
> "Mem Usage", with no overall accumulation of memory consumption as the
> script continues to add and remove DIVs, and running in IE 8 (on XP)
> showed the memory use increase with the first addition and then stay
> at about that level. What I did not observe at all was any steady
> increase in memory use, as would be expected if a memory leak issue
> existed here.
>
> This suggests that IE's garbage collection is successfully dealing
> with this situation without even getting to the point where re-loading
> the page is significant.
>
> On the other hand, running the same code in Drip (with the number of
> DIVs created reduced to 10,000 because Drip slows the script down
> considerably) showed a steady increase in memory consumption.
> Consuming more each time the DIV addition-removal cycle was executed.
>
> This would lead me to conclude that:-
>
> 1. The rumours of issues relating to the use of - removeChild - are
> unsubstantiated and so should be ignored. If they do relate to a
> memory leaking cause and effect relationship then the - removeChild -
> use is not (in isolation, or directly) the cause of whatever effect is
> being observed.
>
> 2. Drip should not be regarded as a definitive indicator of memory
> leak issues as it appears to directly provoke some of the issues it
> attempts to report.
>
> 3. Any supposed memory leak issues with JQuery should be demonstrated
> in isolation else time and (script) performance could be squandered
> attempting to 'fix' non-issues.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to