Open Bug 387709 Opened 17 years ago Updated 2 years ago

Mailnews Datasources Leak

Categories

(MailNews Core :: Backend, defect)

defect

Tracking

(Not tracked)

People

(Reporter: mscott, Unassigned)

References

Details

(Keywords: helpwanted, memory-leak)

Attachments

(3 files)

See Bug 383939 for an explanation of what's going on.

I've got some patches coming up for this.
Blocks: 383939
* convert the mObservers list from a nsISupportsArray to nsCOMArray so we can use the NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY macro.
* remove nsSoundDatasource which was not being built.
* make nsMsgRDFDatasource use the cycle collector. the account manager and folder data sources inherit from this base class.

To test this fix. I turned on the bloat log:

export XPCOM_MEM_LEAK_LOG=leaklog.txt

Started up Thunderbird and quit. Verified that the following objects were leaked:
* CompositeDataSourceImpl   
* nsMsgAccountManagerDataSource (1)
* nsMsgFolderDataSource  (2 of these: one for recent, one for all)
* nsMsgRDFDataSource  (3)

I then repeated this test with this patch and verified that these objects get cycle collected on shut down and are no longer listed in the leak log.
Attachment #271891 - Flags: superreview?(bienvenu)
Comment on attachment 271891 [details] [diff] [review]
[checked in]fix nsMsgRDFDatasource, nsMsgAccountDataSource and nsMsgFolderDatasource leaks

very nice - does this fix the big leak?
Attachment #271891 - Flags: superreview?(bienvenu) → superreview+
sadly it doesn't fix the jscontext leak :(
Attachment #271891 - Attachment description: fix nsMsgRDFDatasource, nsMsgAccountDataSource and nsMsgFolderDatasource leaks → [checked in]fix nsMsgRDFDatasource, nsMsgAccountDataSource and nsMsgFolderDatasource leaks
OS: Windows Vista → All
Hardware: PC → All
Needs mlk key word
Keywords: mlk
Scott: are you intending on fixing up the address book rdf datasource in this bug as well?
yeah I actually wrote a patch for the address book data source but was having a hard time getting some of the thread proxy stuff working with it. I'll post what I had and we can go from there...
Here's the patch I put together for the address book data source. I hadn't gotten around to testing the scenario where the NotifyObservers is called from a thread other than the main thread...
Comment on attachment 273722 [details] [diff] [review]
[checked in]patch for the address book data source

This fixes the leak for me Mark.
Attachment #273722 - Flags: superreview?(bugzilla)
Comment on attachment 273722 [details] [diff] [review]
[checked in]patch for the address book data source

Yep looks good to me, certainly didn't manage to break it in my testing ;-)

Though I can only give r+ not sr+
Attachment #273722 - Flags: superreview?(bugzilla) → review+
Attachment #273722 - Attachment description: patch for the address book data source → [checked in]patch for the address book data source
Comment on attachment 273722 [details] [diff] [review]
[checked in]patch for the address book data source

>Index: nsAbRDFDataSource.cpp
>===================================================================

>+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsAbRDFDataSource)
>+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mObservers)
>+  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mProxyObservers)

This needs to use NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY, not _UNLINK_
Fixes the incorrect macro in the address book data source (see comment 10).
Attachment #287313 - Flags: superreview?(mscott)
Attachment #287313 - Flags: review?(mscott)
Comment on attachment 287313 [details] [diff] [review]
[checked in]Fix unlink/traverse per comment 10

thanks Mark.
Attachment #287313 - Flags: superreview?(mscott)
Attachment #287313 - Flags: superreview+
Attachment #287313 - Flags: review?(mscott)
Attachment #287313 - Flags: review+
Attachment #287313 - Attachment description: Fix unlink/traverse per comment 10 → [checked in]Fix unlink/traverse per comment 10
Blocks: 427198
mark, you probably should take this on?
Assignee: mscott → bugzilla
Flags: blocking-thunderbird3+
Flags: wanted-thunderbird3+
Flags: blocking-thunderbird3-
Flags: blocking-thunderbird3+
Priority: -- → P3
Product: Core → MailNews Core
Mark, status update?
Target Milestone: --- → Thunderbird 3.0b1
(In reply to comment #14)
> Mark, status update?

This seems quite complicated. I'm not sure Scott's original changes were 100% correct, plus we have lots of other potential leaks at the moment.

I just took a look at this again, but based on my 1 hour look, I doubt I'm going to get to this before b1.
Target Milestone: Thunderbird 3.0b1 → Thunderbird 3.0b2
Target Milestone: Thunderbird 3.0b1 → Thunderbird 3.0rc1
Severity: normal → minor
Assignee: bugzilla → nobody
Keywords: helpwanted
Priority: P3 → --
Target Milestone: Thunderbird 3.0rc1 → ---
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: