Re: [xml] Re: error output (again + elaborated)



On Wed, Nov 21, 2001 at 10:48:39AM +0100, robert wrote:
 >It should be called *only* when all processing with libxml has finished
 >in the entire program life.

Some more elaboration:
- xmlInitParser() is called once in the entire lifetime of the program, a
  threaded httpd with builtin scripting language (which has an xslt
  function); this call necessarily has to run when the program is threaded
  already;
- I removed the cleanup-call (the used threadslibrary doesn't actually care
  about memoryleaks), but I got a SIGSEGV in xmlHashLookup because the
  supplied 'table' argument didn't exist anymore (the parser was initialized
  in another thread, in another memory-segment);

Solution: I'm now using a piece of shared (as in: shared by all threads)
memory to initialize the parser in; this prevents the SIGSEGV because of
pointers which don't exist anymore. Not the most elegant solution perhaps,
but it works :)

  Hum, sounds like the kind of problems Lev Serebryakov faced too.
The key point is that the library is not stateless, and when you're
operating with multiple memory pool it's hard to have control over 
the scope of the memory holding this state. This is true both for
data initialized by the library for its internal processing and by
the data generated/processed by the library as a result of the API
calls. 
  Fragmented memory pools are an horrible programming platform IMHO ...

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]