Re: [xml] Memory Leaks in parse3.c example



Bjorn Reese wrote:
Chris Johnson wrote:

Thanks for the reply. I've done further testing and found some very interesting results as follows. It turns out when I compile and link parse3.c with static version of libxml purify turns up several memory leaks as shown in the attached a.out.static. Thinking the leaks are

I do not know why it behave differently in the static and shared
versions, so I will concentrate on the static version that has the
leaks. Furthermore, I do not have access to a Solaris machine at the
moment, so the following is deduced from reading the source code.

It appears that xmlNewGlobalState() is called many times instead of just
once. Can you confirm this? (this is probably easiest done by putting a
breakpoint in the function).

If so, then the problem may be related to the initialization of the
globalvar variable. What is the return value of phread_once() in
xmlGetGlobalState()? Is xmlOnceInit() called, and what is the return
value of pthread_key_create()?

xmlNewGlobalState() is not available to break in but xmlGetGlobalState() is called about 16times. phread_once()'s return value is never checked within the existing codebase but... phread_once() returns 0 all 16times. xmlOnceInit() is never called therefore pthread_key_create is never called from xmlOnceInit().

You may also want to note this is on a Solaris 8 SPARC box.

Hope this helps
..Chris




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