Re: Leaks in nsSessionStore.js?

"Nickolay Ponomarev" <[email protected]> Sun, 18 Nov 2007 03:11:38 +0300
Newsgroups gmane.comp.mozilla.performance
Message-ID <[email protected]>
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).
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).

Nickolay