Closed Bug 41695 Opened 24 years ago Closed 24 years ago

webshells are being leaked on Mac

Categories

(Core :: Layout, defect, P3)

PowerPC
Mac System 8.5
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: sfraser_bugs, Assigned: sfraser_bugs)

Details

(Keywords: memory-leak, platform-parity, Whiteboard: [nsbeta2+])

We leak at least one webshell per top-level window on Mac. This does not seem to 
be happening on other platforms.

This is causing bugs in editor, and probably elsewhere.
Blocks: 41681
Nominating for nsbeta2, because this can cause a whole suite of bugs, as well as 
serious memory leaks.
No longer blocks: 41681
Keywords: nsbeta2, pp
we gotta fix this
Severity: normal → critical
Target Milestone: --- → M16
Blocks: 41681
I'm getting nowhere fast on this one. Help!
Putting on [nsbeta2+] radar for beta2 fix. 
Whiteboard: [nsbeta2+]
Here's one leak:

Index: nsParser.cpp
===================================================================
RCS file: /cvsroot/mozilla/htmlparser/src/nsParser.cpp,v
retrieving revision 3.208
diff -w -c -1 -r3.208 nsParser.cpp
*** nsParser.cpp	2000/05/26 19:45:26	3.208
--- nsParser.cpp	2000/06/08 01:24:41
***************
*** 265,267 ****
    NS_IF_RELEASE(mSink);
! 
    NS_IF_RELEASE(mBundle);
--- 265,267 ----
    NS_IF_RELEASE(mSink);
!   NS_IF_RELEASE(mParserFilter);
    NS_IF_RELEASE(mBundle);
Status: NEW → ASSIGNED
And another:
Index: nsMenuBar.h
===================================================================
RCS file: /cvsroot/mozilla/widget/src/mac/nsMenuBar.h,v
retrieving revision 1.14
diff -w -c -1 -r1.14 nsMenuBar.h
*** nsMenuBar.h	2000/05/26 00:15:28	1.14
--- nsMenuBar.h	2000/06/08 01:25:26
***************
*** 140,143 ****
    
!   nsIWebShell * mWebShell;
!   nsIDOMNode  * mDOMNode;
  
--- 140,143 ----
    
!   nsCOMPtr<nsIWebShell> mWebShell;
!   nsCOMPtr<nsIDOMNode>  mDOMNode;
  
Index: nsMenuBar.cpp
===================================================================
RCS file: /cvsroot/mozilla/widget/src/mac/nsMenuBar.cpp,v
retrieving revision 1.36
diff -w -c -1 -r1.36 nsMenuBar.cpp
*** nsMenuBar.cpp	2000/05/26 00:15:27	1.36
--- nsMenuBar.cpp	2000/06/08 01:25:25
***************
*** 196,201 ****
  {
!   mWebShell = (nsIWebShell*) aWebShell;
!   NS_ADDREF(mWebShell);
! 	mDOMNode  = (nsIDOMNode*)menubarNode;
! 	NS_ADDREF(mDOMNode);
      
--- 196,199 ----
  {
!   mWebShell = NS_STATIC_CAST(nsIWebShell*, aWebShell);
! 	mDOMNode  = NS_STATIC_CAST(nsIDOMNode*, menubarNode);
      
***************
*** 362,365 ****
    mIsMenuBarAdded = PR_FALSE;
-   mWebShell       = nsnull;
-   mDOMNode        = nsnull;
    
--- 360,361 ----
With the above fixes, we cease to leak webshells for the browser window.
However, mozilla -edit still leaks, but it leaks the nsDocShell + 
nsWebShellWindow/nsXULWindow for the hidden window, not the editor window.

I suspect that menu bar switching is to blame, but this is unclear.
More data points:
closing all windows manually, then quitting causes the nsAppShellService to leak 
(and hence the hidden window).
I'm faily convinced that remaining leakage is because of menus. I see leakage of 
nsMenus, nsMenuItems, and nsMenubars when doing a simple startup/quit with 1 
browser window. Over to you, chris.
Assignee: sfraser → saari
Status: ASSIGNED → NEW
No longer blocks: 41681
Taking back. I've nailed these suckers...
Assignee: saari → sfraser
I checked in a bunch of changes to the menu code to leak less, and use weak refs 
where appropriate. Now, we don't leak any webshells on Mac! Yay!
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Marking verified per last comments.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.