Re: [xml] Bug or User Error



Ron Ohmer wrote:

Does anyone have a suggestion as to why I am getting an unhandled exception on a doc=xmlParseFile(filename). It is around the 6th time it runs in a program (Same every time), so I suspect it is running out of stack space.. After every run thru the parser I am sure to run:
xmlFreeDoc(doc);

xmlCleanupParser();

So, I am confused as to how I am leaving open memory out there. My stack is: Program
xmlSAXParseFile
xmlInitParser
xmlNewCharEncodingHandler
xmlStrndup
malloc
The malloc is the offending problem.. Any suggestions?

Well, I had the same kind of crash in a multithreading environment.

xmlInitParser();
// do stuff
xmlCleanupParser();

This done in two threads parallel killed the one still running when
the other cleaned up.

I moved both calls outside into the main routine. If that's the suggested behaviour, it's not that intuitive when you come from
the "for every init an exit call" corner... 8)
Good lucks,

  Coren




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