Closed
Bug 388101
Opened 18 years ago
Closed 18 years ago
nsMsgDatabase leaks a mork factory
Categories
(MailNews Core :: Database, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mscott, Assigned: mscott)
References
Details
(Keywords: memory-leak)
Attachments
(2 files)
1.83 KB,
patch
|
Bienvenu
:
superreview+
|
Details | Diff | Splinter Review |
1.50 KB,
patch
|
Bienvenu
:
superreview+
|
Details | Diff | Splinter Review |
the static method: nsMsgDatabase::GetMDBFactory
has a reference to a nsIMdbFactory which never gets released.
http://mxr.mozilla.org/mozilla/source/mailnews/db/msgdb/src/nsMsgDatabase.cpp#976
Assignee | ||
Comment 1•18 years ago
|
||
I think nsAddrDatabase suffers from the same leak.
Assignee | ||
Comment 2•18 years ago
|
||
This is one way we could fix this leak. nsIMdbFactoryFactory already caches the mork factory for us. See:
NS_IMETHODIMP nsMorkFactoryFactory::GetMdbFactory(nsIMdbFactory **aFactory)
{
if (!gMDBFactory)
gMDBFactory = MakeMdbFactory();
*aFactory = gMDBFactory;
NS_IF_ADDREF(gMDBFactory);
return (gMDBFactory) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
So use a nsCOMPtr and let each database object have its own ref to the factory singleton.
Attachment #272265 -
Flags: superreview?(bienvenu)
Updated•18 years ago
|
Attachment #272265 -
Flags: superreview?(bienvenu) → superreview+
Assignee | ||
Updated•18 years ago
|
Attachment #272265 -
Attachment description: one way to fix this → [checked in]one way to fix this
Assignee | ||
Comment 3•18 years ago
|
||
Attachment #272344 -
Flags: superreview?
Assignee | ||
Updated•18 years ago
|
Attachment #272344 -
Flags: superreview? → superreview?(bienvenu)
Updated•18 years ago
|
Attachment #272344 -
Flags: superreview?(bienvenu) → superreview+
Assignee | ||
Updated•18 years ago
|
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•17 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•