Closed
Bug 53933
Opened 24 years ago
Closed 15 years ago
xptiManifest.cpp leaks a file descriptor
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: jonsmirl, Unassigned)
References
()
Details
(Keywords: memory-leak)
Attachments
(2 files, 2 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review |
line 242, fd is not freed.
if(NS_FAILED(aFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd)) || !fd)
goto out;
if(flen > PR_Read(fd, whole, flen))
goto out;
out:
if(fd)
PR_Close(fd);
*pLength = flen;
return whole;
It doesn't look like PR_Cleanup (which calls _PR_CleanupFdCache) is being
called from the XPConnect standalone build.
I did greps and put a breakpoint on it.
Two attachments are identical, I had a problem with bugzilla.
The call to PR_Cleanup removes over 40 leaks from the simple case of
start/shutdown XPCOM.
In nsThread.cpp:
void
nsThread::Shutdown()
{
if (gMainThread) {
// XXX nspr doesn't seem to be calling the main thread's destructor
// callback, so let's help it out:
nsThread::Exit(NS_STATIC_CAST(nsThread*, gMainThread));
nsrefcnt cnt;
NS_RELEASE2(gMainThread, cnt);
NS_WARN_IF_FALSE(cnt == 0, "Main thread being held past XPCOM
shutdown.");
}
}
nspr was not calling the thread's destructor because PR_Cleanup was not being
called. I have commented out the call to nsThread::Shutdown() in
XPCOM::Shutdown. nsThread::Shutdown down should probably be modified to remove:
nsThread::Exit(NS_STATIC_CAST(nsThread*, gMainThread));
and still release gMainThread
Patch also enables a dump of leaked memory on debug builds under windows and
MSVC. This will help in locating further leaks - there are several hundred.
Following two part patch is a more comprehensive fix. It needs bug 54264 and
bug 53934 fixed to work.
It enables:
1) DLL unloading in component manager.
2) PR_Cleanup during XPCOM shut.
Fixing these two items eliminates approximately one hundred memory leaks.
It is only turned on for XPCOM standalone. It probably works for the browser
too but I didn't test it.
Patch also enables a dump of leaked memory on debug builds under windows and
MSVC. This will help in locating further leaks - there are several hundred.
Comment 8•24 years ago
|
||
Setting Jon Smirl's bugs to New
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 11•23 years ago
|
||
-> cathleen for a new home
Assignee: dprice → asa
Component: XPCOM → Browser-General
QA Contact: rayw → doronr
Updated•20 years ago
|
Product: Browser → Seamonkey
Comment 13•20 years ago
|
||
Jon,
I think this bug may be out of date. I don't want to set it to INVALID because
I don't know enough C++ to properly check if the problem still exists. However,
because line 207 of xptiManifest.cpp is a blank line, I doubt the problem still
exists.
It would be helpful if you emailed me and told me what the status of this bug is.
Thanks,
Joel Nackman
Comment 14•20 years ago
|
||
afaik this bug isn't obsolete. i know i've played with calling pr_cleanup...
Assignee: cathleennscp → dougt
Component: General → XPCOM
Product: Mozilla Application Suite → Core
QA Contact: doronr
Updated•18 years ago
|
Assignee: dougt → nobody
QA Contact: xpcom
Updated•16 years ago
|
Attachment #15416 -
Attachment is obsolete: true
Updated•16 years ago
|
Attachment #15415 -
Attachment is obsolete: true
Comment 15•16 years ago
|
||
The 2 patches have bit-rotted, especially the <nsThread.cpp> one.
Priority: P3 → --
Comment 16•15 years ago
|
||
XPCOM is not going to call PR_Cleanup.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•