Re: Transaction-lifespan memory leak with plpgsql DO blocks

From: Dilip kumar <dilip(dot)kumar(at)huawei(dot)com>
To: "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "polobo(at)yahoo(dot)com" <polobo(at)yahoo(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Transaction-lifespan memory leak with plpgsql DO blocks
Date: 2013-11-13 09:32:16
Message-ID: 4205E661176A124FAF891E0A6BA9135265925877@SZXEML507-MBS.china.huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13 November 2013 03:17 David Johnston wrote,

>
> Having had this same thought WRT the "FOR UPDATE in LOOP" bug posting
> the lack of a listing of outstanding bugs does leave some gaps. I
> would imagine people would appreciate something like:
>
> Frequency: Rare
> Severity: Low
> Fix Complexity: Moderate
> Work Around: Easy - create an actual function; create some form of loop
> Status: Confirmed - Awaiting Volunteers to Fix

This problem is fixed as explained below..

1. Created own simple_eval_estate for every Do block in plpgsql_inline_handler and Freed it after the execution is finished.
2. While executing the simple expression if func->simple_eval_estate is not null (means its Do block) then use this otherwise use globle one.

Patch is attached in the mail.

Please let me know whether this approach is fine or not ?

Regards,
Dilip

Attachment Content-Type Size
transaction-lifespan_memory_leak_fix.patch application/octet-stream 2.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Colin 't Hart 2013-11-13 09:40:31 [PATCH] Sort contents entries in reference documentation
Previous Message Colin 't Hart 2013-11-13 09:28:07 Re: TABLE not synonymous with SELECT * FROM?