Re: Memory use in 8.3 plpgsql with heavy use of xpath() - Mailing list pgsql-general

From Tom Lane
Subject Re: Memory use in 8.3 plpgsql with heavy use of xpath()
Date
Msg-id 18707.1215043591@sss.pgh.pa.us
Whole thread Raw
In response to Re: Memory use in 8.3 plpgsql with heavy use of xpath()  ("Matt Magoffin" <postgresql.org@msqr.us>)
List pgsql-general
"Matt Magoffin" <postgresql.org@msqr.us> writes:
>>> I think this should fix it.
>>> Kris Jurka

Confirmed, that makes it go away nicely here:

  LibxmlContext: 57344 total in 3 blocks; 55720 free (202 chunks); 1624 used

>> It looks like xml.c source has changed considerably since 8.3 (looking at
>> revision 1.68.2.2 from the 8.3.3. release). Do you know where/if this
>> patch would apply to the 8.3 branch?

Here's what I just committed to the 8.3 branch:

Index: xml.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/xml.c,v
retrieving revision 1.68.2.2
diff -c -r1.68.2.2 xml.c
*** xml.c    24 Mar 2008 19:12:58 -0000    1.68.2.2
--- xml.c    2 Jul 2008 23:57:20 -0000
***************
*** 3201,3206 ****
--- 3201,3207 ----
          result = (text *) palloc(len + VARHDRSZ);
          SET_VARSIZE(result, len + VARHDRSZ);
          memcpy(VARDATA(result), str, len);
+         xmlFree(str);
      }

      return result;


            regards, tom lane

pgsql-general by date:

Previous
From: "Matt Magoffin"
Date:
Subject: Re: Memory use in 8.3 plpgsql with heavy use of xpath()
Next
From: Tom Lane
Date:
Subject: Re: Memory use in 8.3 plpgsql with heavy use of xpath()