Skip site navigation (1) Skip section navigation (2)

Re: Re: [COMMITTERS] pgsql: Fix plpgsql to release SPI plans when a function or DO block is

From: Jan Urbański <wulczer(at)wulczer(dot)org>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Fix plpgsql to release SPI plans when a function or DO block is
Date: 2011-03-30 18:21:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committerspgsql-hackers
On 28/03/11 17:25, Stephen Frost wrote:
> * Jan Urbański (wulczer(at)wulczer(dot)org) wrote:
>> On 28/03/11 04:31, Tom Lane wrote:
>>>> Do the other PLs we ship need similar fixes?
>>> Offhand I think the other PLs leave management of prepared plans to the
>>> user.  If there are any places where they cache plans behind the scenes,
>>> maybe a similar fix would be appropriate.
>> FWIW I executed
>> do $$ plpy.execute("select 1 from pg_class") $$ language plpythonu;
>> 10k times in a session and the backend grew a lot in memory and never
>> released it. I can't offhand see where the memory went, I'll try to
>> investigate in the evening.
> I'm about 90% sure that they all have this problem..  I havn't had a
> chance to look at how Tom fixed pl/pgsql (I didn't think it'd be easy to
> do w/o coming up with a way to explicitly tell the PL to release
> something) so perhaps I'm mistaken, but they all share very similar
> code..

Valgrind showed me the way. PFA a trivial patch to avoid leaking a
PLyProcedure struct in inline blocks.

Prepared plans get cleaned up currectly, the SPI plan is deallocated
when the Python plan object is garbage collected.


Attachment: plpython-leak.diff
Description: text/x-patch (584 bytes)

In response to


pgsql-hackers by date

Next:From: Robert HaasDate: 2011-03-30 19:32:26
Subject: Re: pg_dump --binary-upgrade vs. ALTER TYPE ... DROP ATTRIBUTE
Previous:From: Dimitri FontaineDate: 2011-03-30 18:05:36
Subject: Re: Another swing at JSON

pgsql-committers by date

Next:From: Andrew DunstanDate: 2011-03-30 20:43:52
Subject: pgsql: Attempt to unbreak windows builds broken by commit 754baa2.
Previous:From: Heikki LinnakangasDate: 2011-03-30 07:55:45
Subject: pgsql: Check that we've reached end-of-backup also when we're notperfo

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group