Closed Bug 118901 Opened 23 years ago Closed 23 years ago

Memory leak of 28 bytes from 1 block allocated in nsFileInputStream::Create

Categories

(Core :: Networking: File, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED WORKSFORME
mozilla0.9.9

People

(Reporter: stephend, Assigned: neeti)

Details

(Keywords: memory-leak)

Build ID: Latest Win32 trunk running Windows 2000 with Purify.

Summary: Memory leak of 28 bytes from 1 block allocated in 
nsFileInputStream::Create

Steps to Reproduce:

1. Launch mozilla -addressbook (I had 0 Personal Address cards, and 12 
Collected Address cards).
2. It'll select the Personal Addressbook by default, switch to the Collected 
Addressbook.
3.  Shutdown.

    [W] MLK: Memory leak of 28 bytes from 1 block allocated in 
nsFileInputStream::Create(nsISupports *,nsID const&,void * *)
        Distribution of leaked blocks
        Allocation location
        new(UINT)      [MSVCRT.DLL]
        nsFileInputStream::Create(nsISupports *,nsID const&,void * *) 
[nsFileStreams.cpp:449]
        {
            NS_ENSURE_NO_AGGREGATION(aOuter);
        
     =>     nsFileInputStream* stream = new nsFileInputStream();
            if (stream == nsnull)
                return NS_ERROR_OUT_OF_MEMORY;
            NS_ADDREF(stream);
        nsGenericFactory::CreateInstance(nsISupports *,nsID const&,void * *) 
[nsGenericFactory.cpp:74]
                                                       REFNSIID aIID, void 
**aResult)
        {
            if (mInfo->mConstructor) {
     =>         return mInfo->mConstructor(aOuter, aIID, aResult);
            }
        
            return NS_ERROR_FACTORY_NOT_REGISTERED;
        nsComponentManagerImpl::CreateInstance(nsID const&,nsISupports *,nsID 
const&,void * *) [nsComponentManager.cpp:1601]
            nsresult res = FindFactory(aClass, &factory);
            if (NS_SUCCEEDED(res))
            {
     =>         res = factory->CreateInstance(aDelegate, aIID, aResult);
                NS_RELEASE(factory);
            }
            else
        nsComponentManager::CreateInstance(nsID const&,nsISupports *,nsID 
const&,void * *) [nsComponentManagerObsolete.cpp:102]
            nsIComponentManagerObsolete* cm;
            nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)
&cm);
            if (NS_FAILED(rv)) return rv;
     =>     return cm->CreateInstance(aClass, aDelegate, aIID, aResult);
        }
        
        nsresult
        NS_NewLocalFileInputStream(nsIInputStream * *,nsIFile *,int,int,int) 
[nsIFileStreams.h:400]
        nsXULFastLoadFileIO::GetInputStream(nsIInputStream * *) 
[nsXULDocument.cpp:4818]
            if (! mInputStream) {
                nsresult rv;
                nsCOMPtr<nsIInputStream> fileInput;
     =>         rv = NS_NewLocalFileInputStream(getter_AddRefs(fileInput), 
mFile);
                if (NS_FAILED(rv)) return rv;
        
                rv = NS_NewBufferedInputStream(getter_AddRefs(mInputStream),
        nsFastLoadFileWriter::Close(void) [nsFastLoadFile.cpp:1887]
                    return NS_ERROR_UNEXPECTED;
        
                nsCOMPtr<nsIInputStream> input;
     =>         rv = mFileIO->GetInputStream(getter_AddRefs(input));
                if (NS_FAILED(rv))
                    return rv;
        
        nsXULDocument::EndFastLoad(void) [nsXULDocument.cpp:5116]
                // output stream.
                if (! gFastLoadList) {
                    gFastLoadService->SetOutputStream(nsnull);
     =>             rv = objectOutput->Close();
        
                    if (NS_SUCCEEDED(rv) && gChecksumXULFastLoadFile) {
                        rv = gFastLoadService->CacheChecksum(gFastLoadFile,
        nsXULDocument::ResumeWalk(void) [nsXULDocument.cpp:5957]
            // Since we've bothered to load and parse all this fancy XUL, let's 
try to
            // save a condensed serialization of it for faster loading next 
time.  We
            // do this after StartLayout() in case we want to serialize frames.
     =>     EndFastLoad();
        
            for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) {
                nsIDocumentObserver* observer = (nsIDocumentObserver*) 
mObservers[i];
        nsXULDocument::EndLoad(void) [nsXULDocument.cpp:1690]
            rv = PrepareToWalk();
            if (NS_FAILED(rv)) return rv;
        
     =>     return ResumeWalk();
        }
        
        
        XULContentSinkImpl::DidBuildModel(int) [nsXULContentSink.cpp:536]
        
            nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
            if (doc) {
     =>         doc->EndLoad();
                mDocument = nsnull;
            }
        
        CWellFormedDTD::DidBuildModel(UINT,int,nsIParser *,nsIContentSink *) 
[nsWellFormedDTD.cpp:316]
          if(aParser){
            mSink=aParser->GetContentSink();
            if((aNotifySink) && (mSink)) {
     =>         result = mSink->DidBuildModel(1);
        
          #if 0
              /* COMMENT OUT THIS BLOCK IF: you aren't using an 
nsHTMLContentSink...*/
        nsParser::DidBuildModel(UINT) [nsParser.cpp:1385]
          if (IsComplete()) {
            if(mParserContext && !mParserContext->mPrevContext) {
              if (mParserContext->mDTD) {
     =>         result = mParserContext->mDTD->DidBuildModel(anErrorCode,PRBool
(0==mParserContext->mPrevContext),this,mSink);
              }
              //Ref. to bug 61462.
              mParserContext->mRequest = 0;
        nsParser::ResumeParse(int,int,int) [nsParser.cpp:1892]
                    if(!mParserContext->mPrevContext) {
                      if(eOnStop==mParserContext->mStreamListenerState) {
        
     =>                 DidBuildModel(mStreamStatus);
        
                        MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: 
nsParser::ResumeParse(), this=%p\n", this));
                        MOZ_TIMER_STOP(mParseTime);
        nsParser::OnStopRequest(nsIRequest *,nsISupports *,UINT) 
[nsParser.cpp:2516]
             mParserFilter->Finish();
        
          mParserContext->mScanner->SetIncremental(PR_FALSE);
     =>   result=ResumeParse(PR_TRUE,PR_TRUE);
        
          // If the parser isn't enabled, we don't finish parsing till
          // it is reenabled.
        nsJARChannel::OnStopRequest(nsIRequest *,nsISupports *,UINT) 
[nsJARChannel.cpp:612]
            }
        #endif
        
     =>     rv = mUserListener->OnStopRequest(this, mUserContext, aStatus);
            NS_ASSERTION(NS_SUCCEEDED(rv), "OnStopRequest failed");
        
            if (mLoadGroup)
    nsOnStopRequestEvent::HandleEvent(void) [nsRequestObserverProxy.cpp:212]
                NS_ASSERTION(NS_SUCCEEDED(rv), "GetStatus failed for request!");
        
                LOG(("handle stopevent=%8lX\n",(long)this));
     =>         (void) observer->OnStopRequest(mRequest, mContext, status);
            }
        };
        
    PL_HandleEvent [plevent.c:590]
            /* This event better not be on an event queue anymore. */
            PR_ASSERT(PR_CLIST_IS_EMPTY(&self->link));
        
     =>     result = (*self->handler)(self);
            if (NULL != self->synchronousResult) {
              PR_Lock(self->lock);
              self->synchronousResult = result;
    PL_ProcessPendingEvents [plevent.c:520]
                break;
        
              PR_LOG(event_lm, PR_LOG_DEBUG, ("$$$ processing event"));
     =>       PL_HandleEvent(event);
              PR_LOG(event_lm, PR_LOG_DEBUG, ("$$$ done processing event"));
            }
to neeti
Assignee: dougt → neeti
Status: NEW → ASSIGNED
Any way to check other plats?
Purify only runs on Win32 and Solaris...
Target Milestone: --- → mozilla0.9.8
Target Milestone: mozilla0.9.8 → mozilla0.9.9
Stephen: Is this leak still happening? I do not see any nsFileInputStream 
objects leaking, using XPCOM_MEM_BLOAT_LOG.
This is no longer appearing in Windows 2000 running under Purify.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
verified wfm.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.