Memory leak of 129 bytes from 1 block allocated in nsMemory::Alloc

VERIFIED FIXED

Status

MailNews Core
Networking: NNTP
--
major
VERIFIED FIXED
16 years ago
9 years ago

People

(Reporter: stephend@netscape.com (gone - use stephen.donner@gmail.com instead), Assigned: (not reading, please use seth@sspitzer.org instead))

Tracking

({mlk})

Trunk
x86
Windows 2000

Firefox Tracking Flags

(Not tracked)

Details

Not sure who this should go to, perhaps Jag or SCC (if it's string-related).

Build: Latest trunk win32 CVS pull running Purify.

Steps to Reproduce:

1.  Launch mozilla.exe -mail
2.  Open the twisty for news.mozilla.org and open n.p.m.mail-news.
3.  Copy a message to your IMAP Trash folder.
4.  Empty Trash.
5.  Exit.

                [W] MLK: Memory leak of 129 bytes from 1 block allocated in 
PR_Malloc
                    Distribution of leaked blocks
                    Allocation location
                    malloc         [msvcrt.DLL]
                    PR_Malloc      [prmem.c:50]
                    nsMemory::Alloc(UINT) [nsMemoryImpl.cpp:556]
                            if (gMemory == nsnull) {
                                EnsureGlobalMemoryService();
                            }
                     =>     return gMemory->Alloc(size);
                        }
                        
                        NS_EXPORT void*
                    nsStr::EnsureCapacity(nsStr&,UINT) [nsStr.cpp:117]
                        PRBool nsStr::EnsureCapacity(nsStr& aString,PRUint32 
aNewLength) {
                          PRBool result=PR_TRUE;
                          if(aNewLength>aString.mCapacity) {
                     =>     result=Realloc(aString,aNewLength);
                            if(aString.mStr)
                              AddNullTerminator(aString);
                          }
                    nsCString::SetCapacity(UINT) [nsString.cpp:200]
                            if ( aNewCapacity )
                              {
                                if( aNewCapacity > mCapacity )
                     =>           GrowCapacity(*this,aNewCapacity);
                                AddNullTerminator(*this);
                              }
                            else
                    nsACString::InsertFromReadable(nsACString const&,UINT) 
[nsAString.cpp:912]
                        nsACString::InsertFromReadable( const self_type& 
aReadable, index_type atPosition )
                          {
                            if ( this != &aReadable )
                     =>       do_InsertFromReadable(aReadable, atPosition);
                            else
                              InsertFromPromise(aReadable, atPosition);
                          }
                    nsStandardURL::SetPort(int) [nsStandardURL.cpp:958]
                                nsCAutoString buf;
                                buf.Assign(':');
                                buf.AppendInt(port);
                     =>         mSpec.Insert(buf, mHostname.mPos + 
mHostname.mLen);
                                ShiftFromPath(buf.Length());
                            }
                            else if (port == -1) {
                    nsMsgMailNewsUrl::SetPort(int) [nsMsgMailNewsUrl.cpp:501]
                        }
                        
                        NS_IMETHODIMP nsMsgMailNewsUrl::SetPort(PRInt32 aPort)
                     => {
                            return m_baseURL->SetPort(aPort);
                        }
                        
                    nsNNTPProtocol::Initialize(nsIURI *,nsIMsgWindow *) 
[nsNNTPProtocol.cpp:501]
                                    }
                                }
                        
                     =>         rv = m_url->SetPort(port);
                                if (NS_FAILED(rv)) return rv;
                            }
                        
                    nsNntpService::NewChannel(nsIURI *,nsIChannel * *) 
[nsNntpService.cpp:1303]
                          nsCOMPtr <nsINNTPProtocol> nntpProtocol;
                          rv = GetProtocolForUri(aURI, nsnull, getter_AddRefs
(nntpProtocol));
                          if (NS_SUCCEEDED(rv))
                     =>       rv = nntpProtocol->Initialize(aURI, nsnull);
                          if (NS_FAILED(rv)) return rv;
                        
                          return nntpProtocol->QueryInterface(NS_GET_IID
(nsIChannel), (void **) _retval);
                    nsNntpService::DisplayMessage(char const*,nsISupports 
*,nsIMsgWindow *,nsIUrlListener *,WORD const*,nsIURI * *) 
[nsNntpService.cpp:330]
                                    mailnewsUrl->SetMsgWindow(aMsgWindow);
                                  mailnewsUrl->GetLoadGroup(getter_AddRefs
(aLoadGroup));
                                }
                     =>         rv = NewChannel(url, getter_AddRefs(aChannel));
                                if (NS_FAILED(rv)) return rv;
                        
                                rv = aChannel->SetLoadGroup(aLoadGroup);
                    nsNntpService::CopyMessage(char const*,nsIStreamListener 
*,int,nsIUrlListener *,nsIMsgWindow *,nsIURI * *) [nsNntpService.cpp:558]
                            streamSupport = do_QueryInterface
(aMailboxCopyHandler, &rv);
                            if (NS_SUCCEEDED(rv)) {
                                mCopyingOperation = PR_TRUE;
                     =>         rv = DisplayMessage(aSrcMailboxURI, 
streamSupport, aMsgWindow, aUrlListener, nsnull, aURL);
                                mCopyingOperation = PR_FALSE;
                            }
                            return rv;
                    nsImapMailFolder::CopyStreamMessage(nsIMsgDBHdr 
*,nsIMsgFolder *,nsIMsgWindow *,int) [nsImapMailFolder.cpp:5444]
                              return NS_ERROR_NO_INTERFACE;
                        
                                rv = m_copyState->m_msgService->CopyMessage
(uri, streamListener,
                     =>                                                      
isMove && !m_copyState->m_isCrossServerOp, nsnull, aMsgWindow, &url);
                          }
                            return rv;
                        }
                    nsImapMailFolder::CopyMessagesWithStream(nsIMsgFolder 
*,nsISupportsArray *,int,int,nsIMsgWindow *,nsIMsgCopyServiceListener *,int) 
[nsImapMailFolder.cpp:4760]
                              nsCOMPtr<nsIMsgDBHdr> aMessage;
                              aMessage = do_QueryInterface(msgSupport, &rv);
                              if (NS_SUCCEEDED(rv))
                     =>         CopyStreamMessage(aMessage, this, msgWindow, 
isMove);
                              else
                                ClearCopyState(rv);
                            }
                    nsImapMailFolder::CopyMessages(nsIMsgFolder 
*,nsISupportsArray *,int,nsIMsgWindow *,nsIMsgCopyServiceListener *,int,int) 
[nsImapMailFolder.cpp:5247]
                          // if the folders aren't on the same server, do a 
stream base copy
                          if (!sameServer)
                          {
                     =>     rv = CopyMessagesWithStream(srcFolder, messages, 
isMove, PR_TRUE, msgWindow, listener, allowUndo);
                            goto done;
                          }
                        
                    nsMessenger::CopyMessages(nsIMsgFolder *,nsIMsgFolder 
*,nsISupportsArray *,int) [nsMessenger.cpp:1086]
                    XPTC_InvokeByIndex [xptcinvoke.cpp:152]
                    XPCWrappedNative::CallMethod
(XPCCallContext&,CallMode::XPCWrappedNative) [xpcwrappednative.cpp:2009]
                    XPC_WN_CallMethod(JSContext *,JSObject *,UINT,long *,long 
*) [xpcwrappednativejsops.cpp:1266]
                    js_Invoke      [jsinterp.c:832]
Keywords: mlk, nsbeta1
Summary: Memory leak of 129 bytes from 1 block allocated in → Memory leak of 129 bytes from 1 block allocated in nsMemory::Alloc

Comment 1

16 years ago
I believe this is a dup - similar stack trace in nsStr

*** This bug has been marked as a duplicate of 111783 ***
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → DUPLICATE
verified dup.
Status: RESOLVED → VERIFIED
Reopening, since we don't want one bug for anytime anyone leaks a string object.
Status: VERIFIED → REOPENED
Resolution: DUPLICATE → ---

Comment 4

16 years ago
I thought the leak was within the stack trace in bug 111783 (in nsStr code)
mSpec leaking in the stack trace is because we were leaking url on copying
news message to imap folders. I have fixed that in some other bug. 
Status: REOPENED → RESOLVED
Last Resolved: 16 years ago16 years ago
Resolution: --- → FIXED
I don't see this leak anymore with the latest trunk build and Purify, on 
Windows 2000.

Verified FIXED.
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.