MLK: Memory leak of 421 bytes from 9 blocks allocated in nsMsgDatabase::RowCellColumnToAddressCollationKey

VERIFIED FIXED

Status

--
major
VERIFIED FIXED
17 years ago
10 years ago

People

(Reporter: stephend, Assigned: naving)

Tracking

({memory-leak})

Trunk
x86
Windows 2000
memory-leak

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments)

Build ID: Latest trunk, Windows 2000 using Purify.

While verifying bug 112783, I came across this:

Steps to Reproduce:

Sorry, this is all the information I have so far...

1.  My Inbox was sorted by Sender, Ascending.
2.  Had 3 visible new messages (1 near the top of the 3 pane, the other 2 near 
the bottom of the visible area).
3.  I had to find a particular message (for bug 112783) and so scrolled down to 
about the middle of my Inbox.
4.  Clicked on the message (I _bet_ this step isn't important, but you never 
know).

I'll attach screenshots of where the message in step #4 is in relation to the 
new/unread messages.

    [W] MLK: Memory leak of 421 bytes from 9 blocks allocated in PR_Malloc
        Distribution of leaked blocks
        Allocation location
        malloc         [msvcrt.DLL]
        PR_Malloc      [prmem.c:50]
        nsMsgDatabase::RowCellColumnToAddressCollationKey(nsIMdbRow *,UINT,BYTE 
* *,UINT *) [nsMsgDatabase.cpp:2813]
            }
            if (NS_SUCCEEDED(ret))
            {
     =>         ret = CreateCollationKey(NS_ConvertUTF8toUCS2(name).get(), 
result, len);
            }
        
            return ret;
        nsMsgHdr::GetAuthorCollationKey(BYTE * *,UINT *) [nsMsgHdr.cpp:642]
        
        
        NS_IMETHODIMP nsMsgHdr::GetAuthorCollationKey(PRUint8 **resultAuthor, 
PRUint32 *len)
     => {
          return m_mdb->RowCellColumnToAddressCollationKey(GetMDBRow(), m_mdb-
>m_senderColumnToken, resultAuthor, len);
        }
        
        nsMsgDBView::GetInsertIndex(nsIMsgDBHdr *) [nsMsgDBView.obj:3169]
        nsMsgDBView::AddHdr(nsIMsgDBHdr *) [nsMsgDBView.obj:3255]
        nsMsgThreadedDBView::OnNewHeader(UINT,UINT,int) 
[nsMsgThreadedDBView.cpp:536]
            // We used to check if this was the first header in the thread, but 
that's
            // a bit harder in the unreadOnly view. But we'll catch it below.
            if (! (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay))// || 
msgHdr->GetMessageKey() == m_messageDB->GetKeyOfFirstMsgInThread(msgHdr-
>GetMessageKey()))
     =>       rv = AddHdr(msgHdr);
            else    // need to find the thread we added this to so we can 
change the hasnew flag
              // added message to existing thread, but not to view
            {        // Fix flags on thread header.
        nsMsgDBView::OnKeyAdded(UINT,UINT,int,nsIDBChangeListener *) 
[nsMsgDBView.obj:3568]
        nsMsgDatabase::AddNewHdrToDB(nsIMsgDBHdr *,int) [nsMsgDatabase.cpp:2674]
                    nsMsgKey threadParent;
        
                    newHdr->GetThreadParent(&threadParent);
     =>             NotifyKeyAddedAll(key, threadParent, flags, NULL);
                }
            }
            NS_ASSERTION(NS_SUCCEEDED(err), "error creating thread");
        nsImapMailFolder::NormalEndHeaderParseStream(nsIImapProtocol *) 
[nsImapMailFolder.cpp:2555]
            }
            // here we need to tweak flags from uid state..
            if (mDatabase && (!m_msgMovedByFilter || ShowDeletedMessages()))
     =>       mDatabase->AddNewHdrToDB(newMsgHdr, PR_TRUE);
            m_msgParser->Clear(); // clear out parser, because it holds onto a 
msg hdr.
            // I don't think we want to do this - it does bad things like set 
the size incorrectly.
        //    m_msgParser->FinishHeader();
        XPTC_InvokeByIndex [xptcinvoke.cpp:152]
                mov     eax,methodIndex
                shl     eax,2               // *= 4
                add     edx,eax
     =>         call    [edx]               // stdcall, i.e. callee cleans up 
stack.
            }
        }
        #pragma warning(default : 4035) // restore default
        EventHandler   [nsProxyEvent.cpp:514]
                nsresult rv = XPTC_InvokeByIndex( proxyObject->GetRealObject(),
                                                  info->GetMethodIndex(),
                                                  info->GetParameterCount(),
     =>                                           info->GetParameterList());
                info->SetResult(rv);
            }
            else
        md_EventReceiverProc [plevent.c:1071]
            {
                PREventQueue *queue = (PREventQueue *)lParam;
                queue->removeMsg = PR_FALSE;
     =>         PL_ProcessPendingEvents(queue);
                queue->removeMsg = PR_TRUE;
        #ifdef XP_OS2
                return MRFROMLONG(TRUE);
        ScrollDC       [user32.dll]
        ScrollDC       [user32.dll]
        DispatchMessageA [user32.dll]
        DispatchMessageA [USER32.DLL]
        nsAppShell::Run(void) [nsAppShell.cpp:121]
        //      if (!nsToolkit::gAIMMMsgPumpOwner || 
(nsToolkit::gAIMMMsgPumpOwner->OnTranslateMessage(&msg) != S_OK))
        //#endif
                TranslateMessage(&msg);
     =>         ::DispatchMessage(&msg);
                if (mDispatchListener)
                  mDispatchListener->AfterDispatch();
              }
    nsAppShellService::Run(void) [nsAppShellService.cpp:301]
        
        NS_IMETHODIMP
        nsAppShellService::Run(void)
     => {
          return mAppShell->Run();
        }
        
    main1          [nsAppRunner.cpp:1269]
        
          // Start main event loop
          NS_TIMELINE_ENTER("appShell->Run");
     =>   rv = appShell->Run();
          NS_TIMELINE_LEAVE("appShell->Run");
          NS_ASSERTION(NS_SUCCEEDED(rv), "failed to run appshell");
Keywords: mlk, nsbeta1
QA Contact: esther → stephend
Created attachment 60258 [details]
Image # 1: Screenshot of what default Inbox was at launch...had to scroll to image # 2.
Created attachment 60259 [details]
Image # 2 : Selected message is the one I read (and had to scroll to)
(Assignee)

Comment 4

17 years ago
Created attachment 60275 [details] [diff] [review]
proposed fix

free the collation keys after use.
(Assignee)

Comment 5

17 years ago
david, need review. 
Assignee: bienvenu → naving

Comment 6

17 years ago
Comment on attachment 60275 [details] [diff] [review]
proposed fix

r=bienvenu.
Attachment #60275 - Flags: review+

Comment 7

17 years ago
Stephen, the way to reproduce this leak (and for Navin to test his fix), is to
sort the folder by sender, then get new mail in the folder. The leak was when we
were doing an insertion sort by sender on new mail inserted into a folder.

Comment 9

17 years ago
Comment on attachment 60275 [details] [diff] [review]
proposed fix

r=suresh
(Assignee)

Comment 10

17 years ago
fixed
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
Verified FIXED with the current trunk build running under Purify / Windows 2000.
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.