Closed Bug 170022 Opened 18 years ago Closed 18 years ago

leaks of Observer service through cycles

Categories

(SeaMonkey :: UI Design, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED
Future

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Keywords: memory-leak, Whiteboard: [patch])

Attachments

(2 files, 2 obsolete files)

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
Status: NEW → ASSIGNED
Keywords: mlk
Priority: -- → P3
Whiteboard: [patch]
Target Milestone: --- → Future
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
Comment on attachment 102721 [details] [diff] [review]
revised patch (diff -uw)

r=morse
Attachment #102721 - Flags: review+
Comment on attachment 102721 [details] [diff] [review]
revised patch (diff -uw)

sr=jag
Attachment #102721 - Flags: superreview+
Fix checked in to trunk, 2002-11-06 04:54/55 PDT.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Product: Core → Mozilla Application Suite
You need to log in before you can comment on or make changes to this bug.