Re: [xml] Re: Newbie memory allocation problem with xmlDocDumpFormatMemory



On Wed, Oct 27, 2004 at 05:11:36PM -0400, Victor Ng wrote:
When am I allowed to call xmlCleanupParser()?

I'm worried about this last bit from the docs:

"...xmlCleanupParser() only when the process has finished using the
library or XML document built with it."

I'm confused - can I call xmlCleanupParser before my process is
finished with XML processing or not then?  Can I still safely
manipulate my documents _after_ I've call xmlCleanupParser?

  no

Is it safe to do the following?

doc0 = xmlNewDoc(...)
doc1 = xmlNewDoc(...)
doc2 = xmlNewDoc(...)
xmlCleanupParser()

// do stuff to doc 1
xmlFreeDoc(doc1)
xmlCleanupParser()

// do stuff to doc2
xmlCleanupParser()

xmlFreeDoc(doc2)
xmlFreeDoc(doc0)

  not safe.
Only when you have finished using libxml2.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://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]