Re: [xml] xmlCreatePushParserCtxt and initial chunk size



At 10:07 AM 09/27/01 +0100, Gary Pennington wrote:
Is there any reason not to call xmlCreatePushParserCtxt() with a larger
chunk size ( the same as I use with xmlParseChunk() )?

I don't think so. However there does seem to be a sbtelty in this area. 
You will note that you must call xmlParseChunk with a series of flags, 
the last of which is a terminate indicator. I found that I had to call 
xmlParseChunk at least twice to ensure proper behaviour.

Well, good.  I spent three hours last night trying to track down a segfault
in my code.  This was with SAX HTML, and I'm parsing my 24,000 html files
in /usr/doc for testing.

One of those moving target segfaults, too.  Put in a few printf's and the
segfault happens after a different number of files are parsed.  Commenting
out my character handler fixed it, so I have to assume I've got a bug some
place.

But, by following your suggestion to always call the parser twice the
segfault went away.  

Here's where the segfault always showed up:

#0  htmlParseTryOrFinish (ctxt=0x8120248, terminate=0) at HTMLparser.c:4341
#1  0x4008968a in htmlParseChunk (ctxt=0x8120248, 
    chunk=0xbfffe3b8 "es,\nand change the directory name to $NAME.orig.
Then unpack the\nsource again.  Use this source to build from.  Go into the
source\ndirectory and follow the instructions to build it.  If you have
to\ne"..., size=4096, 
    terminate=0) at HTMLparser.c:4617




Bill Moseley
mailto:moseley hank org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]