Re: [xml] libxml and threads
- From: Daniel Veillard <veillard redhat com>
- To: Massimo Cafaro <massimo cafaro unile it>
- Cc: xml gnome org
- Subject: Re: [xml] libxml and threads
- Date: Wed, 23 Feb 2005 06:12:44 -0500
On Wed, Feb 23, 2005 at 11:55:41AM +0100, Massimo Cafaro wrote:
On Feb 23, 2005, at 11:38 AM, Daniel Veillard wrote:
Leak: 0x0110f690 size=48 string 'MUTX'
Call stack: [thread 280c000]: | 0x0 | _pthread_body |
thread_starter | provider_thr | grelc_get_sql |
xmlSAXParseMemoryWithData | xmlCreateMemoryParserCtxt |
xmlNewParserCtxt | xmlInitParserCtxt | xmlDefaultSAXHandlerInit |
__xmlDefaultSAXHandler | xmlGetGlobalState | xmlNewGlobalState |
xmlInitializeGlobalState | xmlInitGlobals | xmlNewMutex | malloc
|
malloc_zone_malloc
The threads code is the only one which can legally do direct
malloc()
without using xmlMalloc(), so it's among the memory use I won't
detect
leaks in regression tests.
I do not understand this. What is exactly what you call threads code?
code from libxml2 thread.c module.
The leaks originates in the xmlParseMemory() function, which is called
No. The leak originate when the application wide thread mutex is
allocated. The fact it comes from xmlParseMemory() is just that you did
not initialize the libxml2 module as explained
1/ in the docs
http://xmlsoft.org/threads.html
"call xmlInitParser() in the "main" thread before using any of the
libxml2 API (except possibly selecting a different memory allocator)"
obviously you are not doing this otherwise that mutex would
have been allocated by the time you call xmlParseMemory()
2/ in my previous mail
in my application many times in many threads. I do not know exactly how
do you check for leaks, I am using a standard tool on Mac OS X. May be
it is worth saying here that the leaks are exactly the same on linux,
as detected by valgrind.
Then your code is likely in error, very first thing is to follow the
documentation about thread safety ! Then come back with a complete
example reproducing the problem on Linux, not 3 lines out of context.
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]