Heads-Up: Beware of xmlCleanupParser() when your package links against libxml2
Tom Lane
tgl at redhat.com
Wed Jan 13 21:07:24 UTC 2010
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.
regards, tom lane
More information about the devel
mailing list