Wednesday, July 2, 2008

Re: [GENERAL] Memory use in 8.3 plpgsql with heavy use of xpath()

Index: src/backend/utils/adt/xml.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/xml.c,v
retrieving revision 1.74
diff -c -r1.74 xml.c
*** src/backend/utils/adt/xml.c 12 May 2008 00:00:51 -0000 1.74
--- src/backend/utils/adt/xml.c 2 Jul 2008 22:22:57 -0000
***************
*** 3160,3165 ****
--- 3160,3166 ----
{
str = xmlXPathCastNodeToString(cur);
result = (xmltype *) cstring_to_text((char *) str);
+ xmlFree(str);
}

return result;
On Wed, 2 Jul 2008, Tom Lane wrote:

> "Matt Magoffin" <postgresql.org@msqr.us> writes:
>> Below is a test case that simulates the use of xpath() within a plpgsql
>> function in my application.
>
> I'm able to duplicate the memory leak in this function with the current
> Fedora 8 libxml2 (2.6.32). The leak is definitely inside libxml2
> itself, because the bloat shows up here:
>

I think this should fix it.

Kris Jurka

No comments: