Re: [xml] per thread memory



On Sat, Jul 19, 2003 at 06:40:46PM +0100, Graham Bennett wrote:
Another question,

Is there any information about the --with-thread-alloc option and how it
is implemented?  I just noticed it when configuring 2.5.8.

  It's probably not what you have in mind. Basically xmlMalloc()/xmlFree()
and xmlRealloc() are global variables, by default they are shared between
threads, if this option is passed each thread has its own copy.

I have some multithreaded test cases, so I'm intending to enable this
option and see what kind of improvement I get.

  That won't improve anything. Only if you define your own memory allocation
pool (for example for workers within an apache process) then this may be
a improvement to have separate, per thread routine.

Are there any known problems (performance or otherwise) with thread
safety and the --with-threads option?  From what I can see all my code
will need to do is to call xmlInitParser() under a mutex.  Does it
matter if the function is called more than once (not concurrently)?

  This should work fine, the only problem I'm aware of is a thread
problem when using NTPL on Linux on PowerPC 64 bits. Seems that
xmlInitParser() should be callable twice, yes... if not it's a bug.

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]