Closed Bug 28867 Opened 25 years ago Closed 17 years ago

nsThread leaked by SetMainThread

Categories

(Core :: XPCOM, defect, P3)

x86
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 29355
Future

People

(Reporter: dbaron, Unassigned)

Details

(Keywords: memory-leak)

I'm assigning this based on CVS Blame on the second part of the problem (warren)
and cc:ing beard since he shows up in CVS blame for the first part.

nsIThread::SetMainThread leaks an nsThread because it is storing the main thread
in a global variable.  SetMainThread is called only from NS_InitXPCOM, so *if*
this thread could be released in NS_ShutdownXPCOM, then that would fix one of
the two extra references.

Actually, though, it seems like the thread is addref'd twice in
nsIThread::GetIThread.  It seems that nsIThread::GetIThread is called only from
SetMainThread (based on LXR), so I'm not sure if this is necessary, but it's not
clear to me why it was done.  Not addref-ing it twice in GetIThread would
actually fix the leak, since there are two outstanding references, although the
correct solution could easily be something else.

A refcount balancer long (with ignore-balanced) is available, when my computer
is on, at
http://dbaron.student.harvard.edu/u/david/leaks/viewer/nsThread.balance-ib.txt
Is it that the xpcom shutdown doesn't free the main thread, or that the main 
thread is declared joinable, and no one ever joins with it? (I haven't 
investigated yet, but I thought I'd ask.)
Target Milestone: M15
Moving non-essential, non-beta2 and performance-related bugs to M17.
Target Milestone: M15 → M17
post-beta2
Target Milestone: M17 → M18
Assignee: warsome → danm
Moving Warren's thread bugs from his circular file to mine, because I was told it 
was the thing to do. Anyone who actually wants these bugs, now, feel free to 
correct my hastiness.
Target Milestone: M18 → mozilla0.9
QA Contact: leger → kandrot
Target Milestone: mozilla0.9 → mozilla1.0
I think something fixed the observable leak here a long time ago.
Blocks: 92580
No longer blocks: 92580
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Target Milestone: mozilla1.0.1 → ---
Target Milestone: --- → Future
Assignee: danm.moz → nobody
QA Contact: kandrot → nobody
QA Contact: nobody → xpcom
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.