Closed moofoo closed 13 years ago
Can you provide a patch, or specific lines with code sample so I know where to make your adjustments?
I think I got the gist of this, and was able to adopt it to 1.0 Mocha. Let me know if this does not work for you. It is in the current develop branch.
In my current project I'm loading fairly hefty pages in windows via the iframe load method. A typical window would include enough css/scripting to bump up memory usage by around 5-10 mb and have around 500 nodes in the document, for example. Testing on Google Chrome, I noticed that memory usage was significantly worse than Firefox. Memory would jump up and then stay put when windows were closed, and continue to climb when windows were re-opened and closed.
After working on this for a few days, I think I finally figured out what's going on. I posted a question to stack overflow: http://stackoverflow.com/questions/4064109/chrome-fails-to-free-memory-garbage-collection-doesnt-occur-as-expected-mootoo/4077616#4077616 , and my own answer (with code) is the last answer there. In short, it looks like chrome doesn't complete the last onunload event of the iframe's window object when it is removed from the DOM as a child of windowEl (when it does the .destroy() method).
My solution to this was to manually trigger the onunload event of the iframe by setting it's src property (="javascript:false") and delaying the execution of windowEl.destroy(); There are some other minor optimizations in the code I put in my answer there, but that's the main one. This could all be unique to my application / Setup and Operating system / etc, of course.