Re: Memory fragmentation?
"L. David Baron" <[email protected]> Thu, 15 Nov 2007 09:55:07 -0800
| Newsgroups | gmane.comp.mozilla.performance |
|---|---|
| Message-ID | <[email protected]> |
On Thursday 2007-11-15 09:39 -0800, Dan Mosedale wrote: > Boris Zbarsky wrote: > > No, we don't. DOM nodes and other refcounted things can outlive the tab > > closure and teardown of the window arbitrarily. Just have some script in > > another window referencing them. > > What percentage of the time do you think we would be able to destroy > them together? Most of time, or am I misunderstanding how often these > sorts of references happen? Well, there's a set of objects that we can destroy when we tear down the document and then another set that we can destroy after the next garbage collection / cycle collection. Some things may occasionally take multiple iterations of cycle collection to be collected (though this generally means there's something deficient about the cycle collection traversal implementations on some objects). I'm not sure whether you count all of that as "together", but that probably gets most objects most of the time. In some cases, script has pointers across windows. This is probably pretty common when Web apps open popups for things like picking a date, choosing seats on a flight, etc. In these cases, the page may end up keeping pointers across windows, and we might not collect some things until both/all windows are closed. There are things like window.opener that require that we (the browser) keep extra windows alive in case the page asks for them. (I'm not sure if there's anything *else* like window.opener, actually, but it does cause us to keep chrome windows alive longer than we might want to.) -David -- L. David Baron http://dbaron.org/ Mozilla Corporation http://www.mozilla.com/