In my build I'm seeing some leaks of the observer service and some corresponding XPConnect wrappers (going both ways) through cycles where observers implemented in JS have some path to the observer service (which prevents the observer service's wrapper from being GCed), and the observer service then in turn owns the observers (through an nsSupportsArray). I'm not sure why these leaks don't show up on tinderbox. There were two GC paths I fixed: 08370748 object 0x83a9c40 XPCWrappedNative_NoHelper via nsXPCWrappedJS::mJSObj(Function).__parent__(ChromeWindow).observerService(XPCWrappedNative_NoHelper). I fixed with the changes to cookieTasksOverlay.xul 086b4958 object 0x86c3970 XPCWrappedNative_NoHelper via nsXPCWrappedJS::mJSObj(Object).observe(Function).__parent__(Call).service(XPCWrappedNative_NoHelper). I fixed with changes to navigator.js There are a bunch of other places that look suspicious but that probably didn't get executed: http://lxr.mozilla.org/seamonkey/source/extensions/cookie/resources/content/cookieTasksOverlay.xul#100 http://lxr.mozilla.org/seamonkey/source/xpfe/components/prefwindow/resources/content/pref-charset.xul#37 http://lxr.mozilla.org/seamonkey/source/xpfe/components/prefwindow/resources/content/pref-languages.xul#35 http://lxr.mozilla.org/seamonkey/source/mailnews/base/prefs/resources/content/pref-viewing_messages.xul#15 http://lxr.mozilla.org/seamonkey/source/mailnews/base/resources/content/folderProps.xul#41 http://lxr.mozilla.org/seamonkey/source/mailnews/compose/prefs/resources/content/pref-composing_messages.xul#14
Brendan pointed out that an alternative (and preferred) solution for the closure cycle is to either null out the service variable or not use a variable at all (since it's only used once).
... so service would have to be changed from const to var if it were kept. The cookie patch looks like it just avoids unnecessary global variables, which can entrain lots of garbage too. /be
Created attachment 102720 [details] [diff] [review] revised patch (diff -u)
Created attachment 102721 [details] [diff] [review] revised patch (diff -uw)
Comment on attachment 102721 [details] [diff] [review] revised patch (diff -uw) r=morse
Comment on attachment 102721 [details] [diff] [review] revised patch (diff -uw) sr=jag
Fix checked in to trunk, 2002-11-06 04:54/55 PDT.