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

Re: [xml] Per parser xmlGcMemSetup



On Sun, May 06, 2007 at 11:23:59AM +0200, Joachim Zobel wrote:
> Am Sonntag, den 06.05.2007, 03:34 -0400 schrieb Daniel Veillard:
> > But mod_i18n should know it is operating on top of libxml2 parser,
> > so why doesn't it use the libxml2 allocation routines ? The SAX interfaces
> > at the C level are really parser specific, and libxml2 SAX2 have been heavilly
> > modified to improve performances, so I don't see why it would use a different
> > allocator then.
> 
> Sax buckets are actually not parser specific. I have no intention on
> being multi parser, but I did not change them much when migrating from
> expat to libxml2. 
> 
> I use apache memory for them for two reasons:
> 1. It is easy to avoid leaks, because apache has memory allocations that
> will automatically be freed when the request is done and
> 2. I know how to use it.
> 
> So I will change my code so that xmlGcMemSetup is called safely. 
> 
> There is however one thing that worries me. If I have to take care for
> libxml2 to not free memory passed into sax callbacks, this probably
> means that on the other end I am leaking memory. Does libxml2 expect the
> sax callbacks to take memory ownership?

  No, actually most strings coming back from libxml2 SAX2 interfaces
are either coming directly from the document stream or allocated from
the parser dictionnary.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]