After a good deal of testing at 250 test runs it seems that the innerHTML "garbage bin" and outerHTML methods are almost identical when it comes to memory usage. outerHTML uses a VERY small amount more (around 36k). I am going to rerun the test at 2000 iterations to see if it makes a difference.
Again, sorry for the delay, work is very hectic these days. I should be able to report back tomorrow during the day (fingers crossed). On Mon, Dec 1, 2008 at 3:26 PM, Andrea Giammarchi < [EMAIL PROTECTED]> wrote: > Just as extra info, it seems that innerHTML with IE does a good work, it is > like minimizing the window and maximizing it back. The problem is that it is > not usable to force the CollectGarbage (that does not do its work as > expected to me ...) ... does anybody else has bad experience with IE and > ExtJS over jQuery? :D > > > On Thu, Nov 27, 2008 at 7:12 PM, Andrea Giammarchi < > [EMAIL PROTECTED]> wrote: > >> Ariel I did a quick test with I don't remember which document and I >> received an error. >> Unfortunately I had no time to investigate but I have exactly the same >> problem, "empty does not empty" at all. >> >> If the trick with outerHTML works I'll try tomorrow in my application and >> I'll tell you. >> >> Regards >> >> >> On Thu, Nov 27, 2008 at 1:39 PM, Ariel Flesler <[EMAIL PROTECTED]>wrote: >> >>> >>> So how do you know some cause errors if you haven't tested yet ? >>> >>> On Thu, Nov 27, 2008 at 9:47 AM, Andrea Giammarchi >>> <[EMAIL PROTECTED]> wrote: >>> > I guess textNodes, html itself and probably iframes. >>> > I'll tell you as soon as I can test stuff :-) >>> > >>> > On Wed, Nov 26, 2008 at 1:21 PM, Ariel Flesler <[EMAIL PROTECTED]> >>> wrote: >>> >> >>> >> Which nodes generate an error ? >>> >> >>> >> On Wed, Nov 26, 2008 at 5:53 AM, Andrea Giammarchi >>> >> <[EMAIL PROTECTED]> wrote: >>> >> > Hi Ariel, is this what you would apply for each nested node in case >>> of >>> >> > $.empty() ? >>> >> > >>> >> > The only problem I can see is with nodes that generate an error if >>> >> > outerHTML >>> >> > property is assigned and a try catch could decrease execution speed. >>> >> > >>> >> > Any ideas? >>> >> > >>> >> > Regards >>> >> > >>> >> > On Tue, Nov 25, 2008 at 11:30 PM, Ariel Flesler <[EMAIL PROTECTED] >>> > >>> >> > wrote: >>> >> >> >>> >> >> Well... I concluded a nicer solution and asked you to try it. >>> >> >> But you never replied... >>> >> >> >>> >> >> http://dev.jquery.com/ticket/3553 >>> >> >> >>> >> >> if (this.parentNode) >>> >> >> this.parentNode.removeChild( this ); >>> >> >> if (jQuery.browser.msie) >>> >> >> this.outerHTML = ""; >>> >> >> >>> >> >> -- >>> >> >> Ariel Flesler >>> >> >> http://flesler.blogspot.com/ >>> >> >> >>> >> >> On Nov 25, 3:28 pm, "Chris Robinson" <[EMAIL PROTECTED]> wrote: >>> >> >> > Hey Nick, >>> >> >> > >>> >> >> > this was never completely resolved. The edited jQuery source I >>> was >>> >> >> > playing >>> >> >> > around with is >>> >> >> > >>> >> >> > here: >>> http://www.outsidethediv.com/memory-leak-test/js/jquery-1.2.6-updated.js >>> >> >> > >>> >> >> > You can try swapping your jquery include with it and see if that >>> >> >> > helps >>> >> >> > at >>> >> >> > all. It seemed to help out a good deal in my case but was rather >>> >> >> > inconclusive in smaller stripped down tests. >>> >> >> > >>> >> >> > On Tue, Nov 25, 2008 at 9:30 AM, Nick <[EMAIL PROTECTED]> >>> wrote: >>> >> >> > >>> >> >> > > I am having a very similar problem. Can someone give more >>> details >>> >> >> > > as >>> >> >> > > how to modify the JQ source file to fix this? >>> >> >> > >>> >> >> > > I have noticed (in Drip) that when I refresh the page, the DOM >>> >> >> > > nodes >>> >> >> > > duplicate. This doesn't make any sense to me since I know JQ >>> >> >> > > unbinds >>> >> >> > > everything on page unload in IE. This node duplication is >>> leading >>> >> >> > > to >>> >> >> > > some serious memory issues in my app that needs to run for up >>> to 8 >>> >> >> > > hours straight without a browser restart. >>> >> >> > >>> >> >> > > Any help would be much appreciated. >>> >> >> > >>> >> >> > > Thanks, >>> >> >> > > Nick >>> >> >> > >>> >> >> > > On Oct 24, 12:50 pm, chris robinson <[EMAIL PROTECTED]> >>> wrote: >>> >> >> > > > Hey all, >>> >> >> > >>> >> >> > > > I believe I have found a leak and have the beginnings of a >>> >> >> > > > solution >>> >> >> > > > to >>> >> >> > > > it. >>> >> >> > >>> >> >> > > > I'm writing an app that preforms ajax searching that returns >>> >> >> > > > pretty >>> >> >> > > > large result sets. I render them via jQuery into a tbody. >>> once >>> >> >> > > > a >>> >> >> > > > subsequent search is performed I call tbody.empty() and >>> append >>> >> >> > > > the >>> >> >> > > > new >>> >> >> > > > results. I created a test harness that would perform a >>> >> >> > > > predefined >>> >> >> > > > search 5000 times in a row with a good amount of time in >>> between. >>> >> >> > >>> >> >> > > > I noticed that IE was allocating quite a bit of memory and >>> never >>> >> >> > > > reclaiming it. At first I thought it was a closure or >>> circular >>> >> >> > > > reference on my part. Once I was sure I had removed them I >>> ran >>> >> >> > > > more >>> >> >> > > > test, sure enough it was still allocating a lot of memory. >>> >> >> > > > Through >>> >> >> > > > a >>> >> >> > > > lot of research I found this articlehttp:// >>> >> >> > >www.scribd.com/doc/2159768/Ajax-Part2 >>> >> >> > > > which says that JS's removeChild will leak in IE. Microsoft >>> uses >>> >> >> > > > another method to remove which is essentially this: >>> >> >> > >>> >> >> > > > function DestroyElement(elem) { >>> >> >> > > > var garbageBin = >>> >> >> > > > document.getElementById('IEMemoryLeakGarbageBin'); >>> >> >> > > > if(garbageBin === undefined) { >>> >> >> > > > garbageBin = document.createElement("DIV"); >>> >> >> > > > garbageBin.id = "IEMemoryLeakGarbageBin"; >>> >> >> > > > garbageBin.style.display = 'none'; >>> >> >> > > > document.body.appendChild(garbageBin); >>> >> >> > > > } >>> >> >> > > > garbageBin.appendChild(elem); >>> >> >> > > > garbageBin.innerHTML = ""; >>> >> >> > >>> >> >> > > > } >>> >> >> > >>> >> >> > > > I went through jQuery 1.2.6 and replaced the removeChild >>> >> >> > > > references >>> >> >> > > > with a check for IE, and if so use this, else use the regular >>> >> >> > > > removeChild. After doing so and rerunning my test I saw >>> drastic >>> >> >> > > > improvements in memory being reallocated after my elements >>> were >>> >> >> > > > removed from the document. >>> >> >> > >>> >> >> > > > I also ran these test on FF, with or without this change it >>> ran >>> >> >> > > > the >>> >> >> > > > same way, recollecting memory correctly. >>> >> >> > >>> >> >> > > > this is only seems to be a drastic performance increase if >>> you >>> >> >> > > > are >>> >> >> > > > creating 1000+ dom elements and binding events to them, but, >>> the >>> >> >> > > > app >>> >> >> > > > I >>> >> >> > > > am writing has to be able to run all day with out leaving or >>> >> >> > > > refreshing the page. >>> >> >> > >>> >> >> > > > I just thought the Dev team might be interested in my >>> findings. >>> >> >> > > > I >>> >> >> > > > plan on striping this down and writing conclusive tests and >>> >> >> > > > documentation over the weekend. >>> >> >> > >>> >> >> > > > -Chris >>> >> >> > >>> >> >> > >>> >> >> >>> >> > >>> >> > >>> >> > > >>> >> > >>> >> >>> >> >>> >> >>> >> -- >>> >> Ariel Flesler >>> >> http://flesler.blogspot.com >>> >> >>> >> >>> > >>> > >>> > > >>> > >>> >>> >>> >>> -- >>> Ariel Flesler >>> http://flesler.blogspot.com >>> >>> >>> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
