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: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, 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-31 09:30:29
Message-ID: 4D9449B5.4070000@wulczer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 31/03/11 07:35, Heikki Linnakangas wrote:
> On 30.03.2011 21:21, Jan Urbański wrote:
>> Valgrind showed me the way. PFA a trivial patch to avoid leaking a
>> PLyProcedure struct in inline blocks.
>
> Hmm, any reason the PLyProcedure struct needs to be allocated in
> TopMemoryContext in the first place? Could you palloc0 it in a
> shorter-lived context, or even better, just allocate it in stack?

Yeah, you're right, you can keep it on the stack.

> PS. I don't think the volatile qualifier in 'proc' is in necessary. The
> variable is not changed in PG_TRY-block.

That always confuses me, but I guess you're right, the variable does not
change, only the memory it points to.

Cheers,
Jan

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-03-31 09:43:01 pgsql: Don't leak the temporary PLyProcedure struct we create for inlin
Previous Message Heikki Linnakangas 2011-03-31 07:20:08 pgsql: Reword the phrase on zero replication_timeout in the docs.

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-03-31 09:43:26 Re: Re: [COMMITTERS] pgsql: Fix plpgsql to release SPI plans when a function or DO block is
Previous Message 高增琦 2011-03-31 08:46:10 Re: crash-safe visibility map, take four