Hi ! Does anybody know a good tool to detect/understand memory leaks in IE. I have a big application with - Prototype - Scriptaculous - TinyMCE - Custom clean developements With Firefox, everythings fine and great ! With Internet Explorer 6, after 5mn to 10mn of navigation between html page, IE is really really slow and takes lot''s of memory. - Is it normal that IE doesn''t garbage collect DOM elements between http request ? - Is there memory leak known when correclty using Prototype''s Event mecanism ? - Is there memory leak with TinyMCE ? That''s really weird and I don''t know how to uderstand what append ? Best regards, -- Jean-Philippe Encausse - R&D Jalios SA Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18 90 15 Do it Once, Use it Twice ~ Do it Twice, Make It Once --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Read my post about how i tracked down the memory leak with morph(), it should give you some tips on how to find out what is at fault. With so many factors in your application you should first start to break it down into smaller chunks to work out what is causing the increase in memory consumption. I.e remove all the effects in the code, and instead just have things appearing and dissappearing using style.display or similar. And just methodically work through your code. On 2/15/07, Jean-Philippe Encausse <Jp-vcK5r0oTKUrk1uMJSBkQmQ@public.gmane.org> wrote:> > Hi ! > Does anybody know a good tool to detect/understand memory leaks in IE. > > I have a big application with > - Prototype > - Scriptaculous > - TinyMCE > - Custom clean developements > > With Firefox, everythings fine and great ! > With Internet Explorer 6, after 5mn to 10mn of navigation between html > page, IE is really really slow and takes lot''s of memory. > > - Is it normal that IE doesn''t garbage collect DOM elements between > http request ? > - Is there memory leak known when correclty using Prototype''s Event mecanism ? > - Is there memory leak with TinyMCE ? > > That''s really weird and I don''t know how to uderstand what append ? > Best regards, > -- > Jean-Philippe Encausse - R&D Jalios SA > Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com > GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net > Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18 90 15 > Do it Once, Use it Twice ~ Do it Twice, Make It Once > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
> - Is it normal that IE doesn''t garbage collect DOM elements between http request?Not that I know of, but it is quite feasible that your http request is failing to cleanup after itself somewhere along the line. > - Is there memory leak known when correclty using Prototype''s Event mecanism ? Between page loads? Maybe. Within a page? Certainly. stopObservers currently does not remove the array containing [element,name,observer,useCapture] that was created during the observe call. I have no doubt your code calls Event.observe *many* times in just one page load (use Firebug''s profiler to see), and this cache is just growing larger and larger. Even on unloadCache it just sets the element to null. As far as I can tell the function is still stored in the Event.observers array. Also, you may think you are stopping your observers correctly but I have seen many people do the following: Event.observe(element,''click'',this.someFunction.bind(this)); Event.stopObserving(element,''click'',this.someFunction.bind(this)); which does not work. Of course if you are getting rid of your element at the same time you''ll never know because an error is never thrown. bind and bindAsEventListener return new functions with each call, so the arguments to observe and stopObserving above are not the same. And then there are all of the widgets we all love to use (like TinyMCE and SAU) but if they don''t provide a cleanup method (usually "dispose") and you don''t make use of it you can be sure you are leaking memory there as well. As Martin recently discovered there are plenty of other ways to leak memory, as subtle as overwriting variables (I guess inadvertently creating closures?). In my experience FF will consume as much memory as IE, maybe it''s due to the plethora of extensions installed. The easiest solution is yet another extension, the "Restart Firefox" extension! Colin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Well, I find the problem: 1. I isolate the JS Lib having memory leak. it is a custom Contextual Menu I developped. 2. I isolate the code doing memory leaks and thats tricky 2.1 I do link.onclick = function() that''s bad ! Now I do an Event.observe() 2.2 More Tricky ! A shortcut explanation: - I have an UL/LI tree in the HTML page - onLoad: --- I create a ContextualMenu Object (called ctxMenuInstance) --- I bind it with UL (UL.ctxmenu = ctxMenuInstance) --- I bind "A.menu" onclick with ctxMenuInstance IE never release memory ! - onUnload: --- I break link between UL and ctxmenu (UL.ctxmenu = null) That''s working ! Does any body know why IE can''t garbage collect the Object I bind to a DOM Element ? Is it a known Memory Leak ? On 2/15/07, Martin Ellis <malard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Read my post about how i tracked down the memory leak with morph(), it > should give you some tips on how to find out what is at fault. With so > many factors in your application you should first start to break it > down into smaller chunks to work out what is causing the increase in > memory consumption. > > I.e remove all the effects in the code, and instead just have things > appearing and dissappearing using style.display or similar. > > And just methodically work through your code. > > On 2/15/07, Jean-Philippe Encausse <Jp-vcK5r0oTKUrk1uMJSBkQmQ@public.gmane.org> wrote: > > > > Hi ! > > Does anybody know a good tool to detect/understand memory leaks in IE. > > > > I have a big application with > > - Prototype > > - Scriptaculous > > - TinyMCE > > - Custom clean developements > > > > With Firefox, everythings fine and great ! > > With Internet Explorer 6, after 5mn to 10mn of navigation between html > > page, IE is really really slow and takes lot''s of memory. > > > > - Is it normal that IE doesn''t garbage collect DOM elements between > > http request ? > > - Is there memory leak known when correclty using Prototype''s Event mecanism ? > > - Is there memory leak with TinyMCE ? > > > > That''s really weird and I don''t know how to uderstand what append ? > > Best regards, > > -- > > Jean-Philippe Encausse - R&D Jalios SA > > Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com > > GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net > > Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18 90 15 > > Do it Once, Use it Twice ~ Do it Twice, Make It Once > > > > > > > > > > >-- Jean-Philippe Encausse - R&D Jalios SA Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18 90 15 Do it Once, Use it Twice ~ Do it Twice, Make It Once --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Jean-Philippe Encausse wrote:> ... > > Does any body know why IE can''t garbage collect the Object I bind to a > DOM Element ? > Is it a known Memory Leak ? >Yes, it is a known memory leak in IE6. IE6 Uses a Windows COM object (instead of a native JScript garbage collector) to garbage collect IE and it doesn''t garbage collect circular references that are no longer needed. If a DOMElement-bound object references the element directly or indirectly, Windows can''t clean it up until IE is closed. |function ClickEventHandler() { // Reference the element using "this" }| |element.expandoClick = ClickEventHandler; element.attachEvent("onclick", element.expandoClick); | Here''s a fairly simple explanation of the problem of binding objects to DOM Elements from the God Father of JavaScript. He also offers some demonstrations and a function to remedy such leaks. http://javascript.crockford.com/memory/leak.html Here''s another article with more examples http://www.bazon.net/mishoo/articles.epl?art_id=824 Here is a more general and dry article from Microsoft discussing JScript memory leaks. The leak in question is discussed under the "Closures" heading. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/IETechCol/dnwebgen/ie_leak_patterns.asp --Ken Snyder --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---