Status

Camino Graveyard
General
RESOLVED FIXED
15 years ago
15 years ago

People

(Reporter: Simon Fraser, Assigned: Simon Fraser)

Tracking

({mlk})

Details

Attachments

(1 attachment)

(Assignee)

Description

15 years ago
Using 'heap' to look at the heap for the application, and checking the heap
after just opening and closing windows, I see tons of memory leaks.

Methodology:
1. Run Navigator, get process ID (enter for <pid> in commands below)
2. Close Navigator windows
3. In termainal, do
     heap <pid> | tail -n +46 | sort > oldheap.txt
(throws away first 46 lines of heap output, leaving the output about cocoa objects)
4. Open a new window, then close it.
5. Do 
     heap <pid> | tail -n +46 | sort > newheap.txt
6. Now compare the two heap logs with:
     diff oldheap.txt newheap.txt > leaksfile.txt

Look at leaksfiel.txt to see what leaked.
(Assignee)

Comment 1

15 years ago
Created attachment 97900 [details]
Sample heap output diff, showing leaks
(Assignee)

Comment 2

15 years ago
You can also run 'leaks <pid>'. To get some useful output from leaks:

leaks <pid> | grep Leak: | awk '{print $3 $4 $5 $6}' | sort | uniq -c | sort -rn
> sortedleaks.txt
Status: NEW → ASSIGNED
(Assignee)

Comment 3

15 years ago
DraggableImageAndTextCell leak fix:

Index: src/bookmarks/BookmarksButton.mm
===================================================================
RCS file: /cvsroot/mozilla/chimera/src/bookmarks/BookmarksButton.mm,v
retrieving revision 1.17.2.4
diff -u -r1.17.2.4 BookmarksButton.mm
--- src/bookmarks/BookmarksButton.mm    28 Aug 2002 23:35:04 -0000      1.17.2.4
+++ src/bookmarks/BookmarksButton.mm    6 Sep 2002 02:11:57 -0000
@@ -45,7 +45,7 @@
 {
   if ( (self = [super initWithFrame:frame]) )
   {
-    DraggableImageAndTextCell* newCell = [[DraggableImageAndTextCell alloc] init];
+    DraggableImageAndTextCell* newCell = [[[DraggableImageAndTextCell alloc]
init] autorelease];
     [newCell setDraggable:YES];
     [self setCell:newCell];
 
(Assignee)

Comment 4

15 years ago
Fix for a bunch of other leaks:

Index: BrowserWindowController.mm
===================================================================
RCS file: /cvsroot/mozilla/chimera/src/browser/BrowserWindowController.mm,v
...
 -(void)setupSidebarTabs
 {
-    IconTabViewItem   *bookItem = [[IconTabViewItem alloc]
initWithIdentifier:@"bookmarkSidebarCHIconTabViewItem"
-                                  withTabIcon:[NSImage imageNamed:@"bookicon"]];
-    IconTabViewItem   *histItem = [[IconTabViewItem alloc]
initWithIdentifier:@"historySidebarCHIconTabViewItem"
-                                  withTabIcon:[NSImage imageNamed:@"historyicon"]];
+    IconTabViewItem   *bookItem = [[[IconTabViewItem alloc]
initWithIdentifier:@"bookmarkSidebarCHIconTabViewItem"
+                                  withTabIcon:[NSImage imageNamed:@"bookicon"]]
autorelease];
+    IconTabViewItem   *histItem = [[[IconTabViewItem alloc]
initWithIdentifier:@"historySidebarCHIconTabViewItem"
+                                  withTabIcon:[NSImage
imageNamed:@"historyicon"]] autorelease];
 #if USE_SEARCH_ITEM
-    IconTabViewItem *searchItem = [[IconTabViewItem alloc]
initWithIdentifier:@"searchSidebarCHIconTabViewItem"
-                                  withTabIcon:[NSImage imageNamed:@"searchicon"]];
+    IconTabViewItem *searchItem = [[[IconTabViewItem alloc]
initWithIdentifier:@"searchSidebarCHIconTabViewItem"
+                                  withTabIcon:[NSImage
imageNamed:@"searchicon"]] autorelease];
 #endif
 #if USE_PANELS_ITEM
-    IconTabViewItem *panelsItem = [[IconTabViewItem alloc]
initWithIdentifier:@"myPanelsCHIconTabViewItem"
-                                  withTabIcon:[NSImage imageNamed:@"panel_icon"]];
+    IconTabViewItem *panelsItem = [[[IconTabViewItem alloc]
initWithIdentifier:@"myPanelsCHIconTabViewItem"
+                                  withTabIcon:[NSImage
imageNamed:@"panel_icon"]] autorelease];
 #endif
     
     [bookItem   setView:[[mSidebarSourceTabView tabViewItemAtIndex:0] view]];
(Assignee)

Comment 5

15 years ago
Index: BrowserTabViewItem.mm
...
 - (void)setLabel:(NSString *)label
 {
-  NSAttributedString* labelString = [[NSAttributedString alloc]
initWithString:label attributes:mLabelAttributes];
+  NSAttributedString* labelString = [[[NSAttributedString alloc]
initWithString:label attributes:mLabelAttributes] autorelease];
   [[mTabContentsView labelCell] setAttributedStringValue:labelString];
 
   [super setLabel:label];
@@ -512,6 +514,17 @@
   [self setTabIcon:newIcon];
   mDraggable = draggable;
   [[mTabContentsView labelCell] setImageAlpha:(draggable ? 1.0 : 0.6)];  
}
(Assignee)

Comment 6

15 years ago
Index: IconTabViewItem.mm
===================================================================
RCS file: /cvsroot/mozilla/chimera/src/extensions/IconTabViewItem.mm,v
retrieving revision 1.4
diff -u -r1.4 IconTabViewItem.mm
--- IconTabViewItem.mm  21 Aug 2002 02:06:27 -0000      1.4
+++ IconTabViewItem.mm  6 Sep 2002 06:58:26 -0000
@@ -79,6 +79,7 @@
 {
   [mTabIcon release];
   [mLabelAttributes release];
+  [mLabelString release];
   [mTruncLabelString release];
   [super dealloc];
 }
(Assignee)

Comment 7

15 years ago
Index: BrowserWrapper.mm
===================================================================
RCS file: /cvsroot/mozilla/chimera/src/browser/BrowserWrapper.mm,v
retrieving revision 1.30.2.3
diff -u -r1.30.2.3 BrowserWrapper.mm
--- BrowserWrapper.mm	4 Sep 2002 17:50:15 -0000	1.30.2.3
+++ BrowserWrapper.mm	6 Sep 2002 07:17:27 -0000
@@ -131,7 +131,8 @@
   [mDefaultStatusString release];
   [mLoadingStatusString release];
   [mToolTip release];
-
+  [mTitle release];
+  
   [super dealloc];
 }
 

Comment 8

15 years ago
r=brade on all of the above fixes (though you can remove the spaces from the
blank line you added in BrowserWrapper.mm)

I'll dupe some of the bugs I filed since the fixes are here.
Keywords: mlk

Comment 9

15 years ago
*** Bug 164274 has been marked as a duplicate of this bug. ***
(Assignee)

Comment 10

15 years ago
There's a leak in GoMenu.mm:

Index: browser/GoMenu.mm
===================================================================
RCS file: /cvsroot/mozilla/chimera/src/browser/GoMenu.mm,v
retrieving revision 1.7
diff -u -r1.7 GoMenu.mm
--- browser/GoMenu.mm	21 Aug 2002 02:06:09 -0000	1.7
+++ browser/GoMenu.mm	1 Nov 2002 05:43:12 -0000
@@ -64,7 +64,7 @@
   if (!wrapper) return nsnull;
   CHBrowserView* view = [wrapper getBrowserView];
   if (!view) return nsnull;
-  nsCOMPtr<nsIWebBrowser> webBrowser = [view getWebBrowser];
+  nsCOMPtr<nsIWebBrowser> webBrowser = getter_AddRefs([view getWebBrowser]);
   if (!webBrowser) return nsnull;
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(webBrowser));
   return webNav.get();
(Assignee)

Comment 11

15 years ago
These have been fixed.
Status: ASSIGNED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.