Re: [xml] Memory concerns in multi-threaded applications



On Tue, Jan 07, 2003 at 07:02:25PM +0530, Ganesh Sivaraman wrote:
Hi,
  I was reading the "Memory Management" section about the
xmlCleanUpParser() routine. It says "..but be careful of the
consequences in multithreaded applications.."

I'm using the parser routines in a multi-threaded appln. The
xmlInitParser() is called in the main() program and the
xmlCleanUpParser() routine is called after the parsing is done(in, say,
getXmlInfo()). Now, if 2 or more threads invoke the getXmlInfo()
simultaneously, would there be any problems when they call the
xmlCleanUpParser() i.e. what care has to be taken for multi-threaded
applns?

  xmlCleanUpParser() should be called only once, once your application
have finished using libxml2 (and libxslt). If you can't garantee this,
don't call it.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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