From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: memory leak in libxml2 - fix |
Date: | 2010-11-26 19:14:08 |
Message-ID: | 14418.1290798848@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> 2010/11/26 Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>:
>> Why did you change doctree and ctxt to global variables?
>> I'm not sure why /* xmlFreeDoc(doctree); */ is commented out
>> at the end of pgxml_xpath(), but is it enough to enable the code?
> I am thinking, so you must not to call xmlFreeDoc(doctree) early.
> Probably xmlXPathCastToXXX reading a doctree.
Those static variables are really ugly, and what's more this patch only
stops some of the leakage. Per experimentation, the result object from
pgxml_xpath has to be freed too, once it's been safely converted to
whatever the end result type is. You can see this by watching
select sum(xpath_number('<data>' || generate_series || '</data>','/data')) from
generate_series(1,500000);
which still shows leakage with the submitted patch. I cleaned it up
as per attached, which doesn't show any leakage.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
xml2-leakage-2.patch | text/x-patch | 10.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2010-11-26 19:19:51 | Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running |
Previous Message | Heikki Linnakangas | 2010-11-26 19:06:18 | Re: Assertion failure on hot standby |