Closed Bug 29379 Opened 25 years ago Closed 24 years ago

MLK while consuming newline tokens

Categories

(Core :: DOM: HTML Parser, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: bruce, Assigned: harishd)

Details

(Keywords: memory-leak)

This happens when loading sample #8 in viewer.  Two leak things are pasted here.
Build from last night on Solaris.

         MLK: 3380 bytes leaked in 26 blocks
         This memory was allocated from:
               malloc         [rtlib.o]
               PR_Malloc      [prmem.c:38]
               nsAllocatorImpl::Alloc(unsigned int) [nsAllocator.cpp:82]
               nsAllocator::Alloc(unsigned int) [nsAllocator.cpp:148]
               nsStr::Alloc(nsStr&,unsigned int) [nsStr.cpp:663]
               nsStr::Realloc(nsStr&,unsigned int) [nsStr.cpp:690]
               nsStr::EnsureCapacity(nsStr&,unsigned int) [nsStr.cpp:100]
               nsStr::GrowCapacity(nsStr&,unsigned int) [nsStr.cpp:120]
               nsStr::Append(nsStr&,const nsStr&,unsigned int,int)
[nsStr.cpp:166]
               nsString::Append(unsigned short) [nsString2.cpp:1168]
               nsString::Assign(unsigned short) [nsString2.cpp:1006]
               nsString::operator =(unsigned short) [nsString2.h:432]
               CNewlineToken::Consume(unsigned short,nsScanner&,int)
[nsHTMLTokens.cpp:1016]
               nsHTMLTokenizer::ConsumeNewline(unsigned
short,CToken*&,nsScanner&) [nsHTMLTokenizer.cpp:738]
               nsHTMLTokenizer::ConsumeToken(nsScanner&,int&)
[nsHTMLTokenizer.cpp:316]
               nsParser::Tokenize(int) [nsParser.cpp:1618]
               nsParser::ResumeParse(nsIDTD*,int) [nsParser.cpp:1129]
              
nsParser::OnDataAvailable(nsIChannel*,nsISupports*,nsIInputStream*,unsigned
int,unsigned int) [nsParser.cpp:1511]
              
nsDocumentOpenInfo::OnDataAvailable(nsIChannel*,nsISupports*,nsIInputStream*,unsigned
int,unsigned int) [nsURILoader.cpp:262]
              
nsResChannel::OnDataAvailable(nsIChannel*,nsISupports*,nsIInputStream*,unsigned
int,unsigned int) [nsResChannel.cpp:618]
              
nsFileChannel::OnDataAvailable(nsIChannel*,nsISupports*,nsIInputStream*,unsigned
int,unsigned int) [nsFileChannel.cpp:468]
               nsOnDataAvailableEvent::HandleEvent()
[nsAsyncStreamListener.cpp:373]
               nsStreamListenerEvent::HandlePLEvent(PLEvent*)
[nsAsyncStreamListener.cpp:97]
               PL_HandleEvent [plevent.c:526]
               PL_ProcessPendingEvents [plevent.c:487]
               nsEventQueueImpl::ProcessPendingEvents() [nsEventQueue.cpp:298]
               event_processor_callback(void*,int,GdkInputCondition)
[nsAppShell.cpp:141]
               our_gdk_io_invoke(_GIOChannel*,GIOCondition,void*)
[nsAppShell.cpp:54]
               g_io_unix_dispatch [giounix.c:131]
               g_main_dispatch [gmain.c:647]
         Block of 130 bytes (26 times); last block at 0xc1d430



         MLK: 1248 bytes leaked in 26 blocks
         This memory was allocated from:
               malloc         [rtlib.o]
               __bUiLtIn_nEw  [libxpcom.so]
               __builtin_new  [rtlib.o]
               CTokenRecycler::CreateTokenOfType(eHTMLTokenTypes,nsHTMLTag)
[nsDTDUtils.cpp:769]
               nsHTMLTokenizer::ConsumeNewline(unsigned
short,CToken*&,nsScanner&) [nsHTMLTokenizer.cpp:735]
               nsHTMLTokenizer::ConsumeToken(nsScanner&,int&)
[nsHTMLTokenizer.cpp:316]
               nsParser::Tokenize(int) [nsParser.cpp:1618]
               nsParser::ResumeParse(nsIDTD*,int) [nsParser.cpp:1129]
              
nsParser::OnDataAvailable(nsIChannel*,nsISupports*,nsIInputStream*,unsigned
int,unsigned int) [nsParser.cpp:1511]
              
nsDocumentOpenInfo::OnDataAvailable(nsIChannel*,nsISupports*,nsIInputStream*,unsigned
int,unsigned int) [nsURILoader.cpp:262]
              
nsResChannel::OnDataAvailable(nsIChannel*,nsISupports*,nsIInputStream*,unsigned
int,unsigned int) [nsResChannel.cpp:618]
              
nsFileChannel::OnDataAvailable(nsIChannel*,nsISupports*,nsIInputStream*,unsigned
int,unsigned int) [nsFileChannel.cpp:468]
               nsOnDataAvailableEvent::HandleEvent()
[nsAsyncStreamListener.cpp:373]
               nsStreamListenerEvent::HandlePLEvent(PLEvent*)
[nsAsyncStreamListener.cpp:97]
               PL_HandleEvent [plevent.c:526]
               PL_ProcessPendingEvents [plevent.c:487]
               nsEventQueueImpl::ProcessPendingEvents() [nsEventQueue.cpp:298]
               event_processor_callback(void*,int,GdkInputCondition)
[nsAppShell.cpp:141]
               our_gdk_io_invoke(_GIOChannel*,GIOCondition,void*)
[nsAppShell.cpp:54]
               g_io_unix_dispatch [giounix.c:131]
               g_main_dispatch [gmain.c:647]
               g_main_iterate [gmain.c:854]
               g_main_run     [gmain.c:912]
               gtk_main       [gtkmain.c:475]
               nsAppShell::Run() [nsAppShell.cpp:304]
               nsNativeViewerApp::Run() [nsGtkMain.cpp:50]
               main           [nsGtkMain.cpp:168]
               _start         [crt1.o]
         Block of 48 bytes (26 times); last block at 0xc1d348
Harish -- one for you.
Assignee: rickg → harishd
This patch should fix at least part of the newline token leak (this was sent
to rickg some time ago but due to his workload he hasn't had time to look into
this yet, thus I'm submitting it here too).

Index: htmlparser/src/CNavDTD.cpp
===================================================================
RCS file: /cvsroot/mozilla/htmlparser/src/CNavDTD.cpp,v
retrieving revision 3.268
diff -u -r3.268 CNavDTD.cpp
--- CNavDTD.cpp 2000/02/26 06:14:28     3.268
+++ CNavDTD.cpp 2000/02/28 01:33:39
@@ -841,6 +841,7 @@
           if(eToken_newline==theType){
             mLineNumber++;
             mTokenizer->PopToken();  //skip 1st newline inside PRE and LISTING
+            mTokenRecycler->RecycleToken(theNextToken);
           }//if
         }//if
       }
This leak has been fixed in my tree and is been sitting in there waiting for the 
tree to open for M15.  Thanx anyway for the patch.
Target Milestone: M16
Since the tree is open now, can this go in soon?  Thanks!
The crack has been sealed.  Marking FIXED.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
updated qa contact.
QA Contact: janc → bsharma
Verified on:
build: 2001-04-02-09-Mtrunk
platform: WinNT

Marking it verified as per above developer comments.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.