Memory leak of 52 bytes from 1 block allocated in nsGrid::BuildCellMap

VERIFIED FIXED

Status

()

Core
XUL
VERIFIED FIXED
17 years ago
10 years ago

People

(Reporter: stephend@netscape.com (gone - use stephen.donner@gmail.com instead), Assigned: Brian Ryner (not reading))

Tracking

({memory-leak})

Trunk
x86
Windows 2000
memory-leak
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

Windows 2000, latest trunk pull via CVS with Purify.

Saw this just reading mail and then doing a Quick Search on IMAP 
with 'subject=re'.

[W] MLK: Memory leak of 52 bytes from 1 block allocated in nsGrid::BuildCellMap
(int,int,nsGridCell * *)
    Distribution of leaked blocks
        52 bytes from 1 block of 52 bytes (0x09021ad0) 
    Allocation location
    new(UINT)      [msvcrt.DLL]
    nsGrid::BuildCellMap(int,int,nsGridCell * *) [nsGrid.cpp:417]
      else {
        if (size > oldsize) {
          delete[] mCellMap;
 =>       (*aCells) = new nsGridCell[size];
        } else {
          // clear out cellmap
          for (PRInt32 i=0; i < oldsize; i++)
    nsGrid::RebuildIfNeeded(void) [nsGrid.cpp:238]
      BuildRows(mColumnBox, columnCount, &mColumns, PR_FALSE);
    
      // build and populate the cell map
 =>   BuildCellMap(rowCount, columnCount, &mCellMap);
    
      mRowCount = rowCount;
      mColumnCount = columnCount;
    nsGrid::GetMinRowHeight(nsBoxLayoutState&,int,int&,int) [nsGrid.cpp:994]
    nsresult
    nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& 
aSize, PRBool aIsHorizontal)
    {
 =>   RebuildIfNeeded();
    
      nsGridRow* row = GetRowAt(aIndex, aIsHorizontal);
    
    nsGrid::GetMinRowSize(nsBoxLayoutState&,int,nsSize&,int) [nsGrid.cpp:596]
      //  return NS_OK;
        
          nscoord height = 0;
     =>   GetMinRowHeight(aState, aRowIndex, height, aIsHorizontal);
          SetLargestSize(aSize, height, aIsHorizontal);
        
          return NS_OK;
    nsGridRowLeafLayout::GetMinSize(nsIBox *,nsBoxLayoutState&,nsSize&) 
[nsGridRowLeafLayout.cpp:110]
          if (!grid)
            return nsGridRowLayout::GetMinSize(aBox, aState, aSize);
          else {
     =>     nsresult rv = grid->GetMinRowSize(aState, index, aSize, 
isHorizontal);
            AddBorderAndPadding(aBox, aSize);
            AddInset(aBox, aSize);
            return rv;
    nsContainerBox::GetMinSize(nsBoxLayoutState&,nsSize&) 
[nsContainerBox.cpp:539]
    nsBoxFrame::GetMinSize(nsBoxLayoutState&,nsSize&) [nsBoxFrame.cpp:1037]
    nsGridRowGroupLayout::GetMinSize(nsIBox *,nsBoxLayoutState&,nsSize&) 
[nsGridRowGroupLayout.cpp:169]
    nsContainerBox::GetMinSize(nsBoxLayoutState&,nsSize&) 
[nsContainerBox.cpp:539]
    nsBoxFrame::GetMinSize(nsBoxLayoutState&,nsSize&) [nsBoxFrame.cpp:1037]
    nsGridLayout2::GetMinSize(nsIBox *,nsBoxLayoutState&,nsSize&) 
[nsGridLayout2.cpp:107]
    nsContainerBox::GetMinSize(nsBoxLayoutState&,nsSize&) 
[nsContainerBox.cpp:539]
    nsBoxFrame::GetMinSize(nsBoxLayoutState&,nsSize&) [nsBoxFrame.cpp:1037]
    nsContainerBox::GetMinSize(nsBoxLayoutState&,nsSize&) 
[nsContainerBox.cpp:539]
    nsBoxFrame::GetMinSize(nsBoxLayoutState&,nsSize&) [nsBoxFrame.cpp:1037]
    nsBoxFrame::GetPrefSize(nsBoxLayoutState&,nsSize&) [nsBoxFrame.cpp:999]
    nsContainerBox::GetPrefSize(nsBoxLayoutState&,nsSize&) 
[nsContainerBox.cpp:503]
    nsBoxFrame::GetPrefSize(nsBoxLayoutState&,nsSize&) [nsBoxFrame.cpp:999]
    nsContainerBox::GetPrefSize(nsBoxLayoutState&,nsSize&) 
[nsContainerBox.cpp:503]
Keywords: mailtrack, mlk
grid=evaughan
Assignee: hyatt → evaughan

Comment 3

17 years ago
looks like this is the same fix as in bug 109490, r=naving

Comment 4

17 years ago
Comment on attachment 57970 [details] [diff] [review]
Fix

sr=hewitt
Attachment #57970 - Flags: superreview+
1.9 evaughan%netscape.com Dec 3 15:41 Facelift for nsBoxToBlockAdaptor -r hyatt
-sr waterson #110328
Grid memory leak -r naving -sr hewitt #109490

This was the same patch, for both bugs.  It has landed, marking FIXED.
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
re-opening, I spoke too soon.  The patch for the other bug doesn't fix this.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #57970 - Attachment is obsolete: true
re-assigning to hewitt, in hopes of this one day getting fixed.
Assignee: eric → hewitt
Status: REOPENED → NEW
(Assignee)

Comment 10

17 years ago
Comment on attachment 69443 [details] [diff] [review]
Patch, Purify likes it!

fix the indentation on the closing brace and r=bryner.
Attachment #69443 - Flags: review+
Comment on attachment 69443 [details] [diff] [review]
Patch, Purify likes it!

Back that closing brace out 2 spaces, and sr=shaver.
Attachment #69443 - Flags: review+ → superreview+
C:\moz_src\mozilla\layout\xul\base\src\grid>cvs commit -m "Bug 109500.  Memory 
leak of 52 bytes in grid code.  Patch by Brian Ryner (bryner@netscape.com). 
r=bryner@netscape.com, sr=shaver@mozilla.org" nsGrid.cp
p
Checking in nsGrid.cpp;
/cvsroot/mozilla/layout/xul/base/src/grid/nsGrid.cpp,v  <--  nsGrid.cpp
new revision: 1.10; previous revision: 1.9
done

(For sanity, here is what I landed) -

Index: nsGrid.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/xul/base/src/grid/nsGrid.cpp,v
retrieving revision 1.9
diff -u -r1.9 nsGrid.cpp
--- nsGrid.cpp	3 Dec 2001 23:41:13 -0000	1.9
+++ nsGrid.cpp	14 Feb 2002 09:41:00 -0000
@@ -414,8 +414,10 @@
 {
   PRInt32 size = aRows*aColumns;
   PRInt32 oldsize = mRowCount*mColumnCount;
-  if (size == 0)
+  if (size == 0) {
+    delete[] mCellMap;
     (*aCells) = nsnull;
+  }
   else {
     if (size > oldsize) {
       delete[] mCellMap;
Assignee: hewitt → bryner
F-I-X-E-D.
Status: NEW → RESOLVED
Last Resolved: 17 years ago17 years ago
Resolution: --- → FIXED
verified fixed with the latest win32 tip
Status: RESOLVED → VERIFIED

Updated

10 years ago
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.