Re: [xml] Debugging memory allocation failures...



On Wed, Oct 20, 2004 at 05:18:42PM -0700, Nathanael Noblet wrote:
Hello
      So I'm playing around a little with libxml and Apache modules. I 
      have a program that I tested out and now I'm playing with it through Apache 
modules. It doesn't quite work. I've done a little debugging by 
printing where I was and some of the elements... Here's what I've done:

I have a generic apache module template created from apxs. It prints 
out a string. or multiple strings. At first what I tried was taking my 
program and calling it from the apache handler function. Partially 
worked. I wanted to use the xmlDocDumpMemory() to get a handle on the 
assembled xml. I always get a null for the xmlChar **out_buffer. So I 
thought perhaps it had something to do with memory allocation of libxml 
conflicting with memory allocation of apache or apr or whatever. but 
when I do the first parse of xmlReadMemory() the doc isn't null. and I 
can use a modified version of print_element_names() to print out to the 
browser the xml element names and attributes etc...

      So how come I can use libxml from my module, but xmlDocDumpMemory 
fails? How can I tell why it failed? Ideas etc...?

  First read this if not already done:
    http://xmlsoft.org/xmlmem.html
You can provide your own memory allocator and use this for debugging,
but I would suggest to run apache under a debugger as a single server
put a breakpoint in the xmlDocDumpMemory and make a request triggering
it, then check what's happening. You can waste a lot of time if you
don't use the debugger approach.

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]