On 20/03/2014 02:25, Boris Zbarsky wrote:
On 3/19/14 9:41 PM, Justin Dolske wrote:
It uses a weak reference with the observer service, plus a dummy strong
reference (via addEventListener()) to automatically manage the
lifetime... When the node/document does away, so does the event listener.
This is sort of ok for notifications that fire a lot, but for
notifications that fire rarely, or never, this effectively leaks a word
of memory in the observer service. And then they all get touched at
shudown. We've had bugs with hundreds of thousands of dead weak
observers all hanging out in the observer service making shutdown take
minutes. :(
For cases like the one linked to there, it really would be good to have
a better option than dealing with the observer service...
-Boris
So the observer service takes a flag that indicates whether it should
hold a weak ref. Can we make that flag trigger periodic 'alive' checks
which clear out the dead weakrefs (or, still better, a subclass of
whatever weak reference class is used, that gets notified if its target
is GC'd and immediately removes itself)? Is that a dumb/impossible idea?
I honestly don't know! :-)
~ Gijs
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform