Heads-Up: Beware of xmlCleanupParser() when your package links against libxml2

Daniel Veillard veillard at redhat.com
Mon Jan 18 13:41:54 UTC 2010


On Wed, Jan 13, 2010 at 04:07:24PM -0500, Tom Lane wrote:
> Lennart Poettering <mzerqung at 0pointer.de> writes:
> > There's something else that came to my mind: if libxml2 is loaded into
> > memory indirectly because some dlopen'ed module wanted it, and then
> > used, and then unloaded again because the module got dlcose'd again,
> > won't you leak TLS vars unless the xmlCleanupParser() function was
> > called properly before? In that case, not calling xmlCleanupParser()
> > is an error, right? And calling it, too, since some other
> > plugin/thread might still need it. Which means you are in a dilemma:
> > in either case you are doing it wrong.
> 
> Got it in one.  libxml's API in this area is unusably broken, and needs
> a ground-up redesign not random messages telling users that they didn't
> use it right --- there *is* no right way to use it.
> 
> My experience with this comes from the Postgres project, which wasted
> many moons trying to use xmlMemSetup() ... basically, you can't replace
> libxml's memory management, you just have to live with whatever it
> chooses to leak.

  First time I see something coming from you or Postgres group
complaining about a leak or about the use of xmlMemSetup()

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


More information about the devel mailing list