Re: Leaks in nsSessionStore.js?
"Michael Vincent van Rantwijk, MultiZilla" <[email protected]> Sun, 18 Nov 2007 05:18:15 +0100
| Newsgroups | gmane.comp.mozilla.performance |
|---|---|
| Message-ID | <[email protected]> |
Nickolay Ponomarev wrote: > On Nov 17, 2007 8:55 PM, Jeff Walden <[email protected]> wrote: >> Michael Vincent van Rantwijk, MultiZilla wrote: >>> However, what I still fail to understand is _when_ I should (must?) use >>> weak references instead of a strong one; because most observers in the >>> CVS tree seem to be using a strong reference. >> I'm not sure there are entirely clear guidelines here, > > There's one case you shouldn't use weak reference from my experience: > when the observer is in a window (as opposed to a JS component). Okay, so weak references should only be used in components. Clear. > Otherwise since there is a period of time when the window is closed, > but the GC hasn't happened, your observer may run in a closed window, > which usually leads to scary-sounding assertions and wrong behavior > (JS errors at least). Dialogs leaked like crazy in older builds, because the button observers where not removed, but I guess that this so called 'cycle collector' (or whatever the name is) takes care of it now, but only for strong observers? -- Michael Vincent van Rantwijk - MultiZilla Project Team Lead - XUL Boot Camp Staff member (ActiveState Training Partner) - iPhone Application Developer