pgsql: Fix I/O-conversion-related memory leaks in plpgsql.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix I/O-conversion-related memory leaks in plpgsql.
Date: 2012-02-11 23:07:35
Message-ID: E1RwM2Z-0000Lt-Qr@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix I/O-conversion-related memory leaks in plpgsql.

Datatype I/O functions are allowed to leak memory in CurrentMemoryContext,
since they are generally called in short-lived contexts. However, plpgsql
calls such functions for purposes of type conversion, and was calling them
in its procedure context. Therefore, any leaked memory would not be
recovered until the end of the plpgsql function. If such a conversion
was done within a loop, quite a bit of memory could get consumed. Fix by
calling such functions in the transient "eval_econtext", and adjust other
logic to match. Back-patch to all supported versions.

Andres Freund, Jan Urbański, Tom Lane

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/03c66ca5dfd4e0e8fec506315f581b21817f47f4

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 162 +++++++++++++++++++++++++-----------------
1 files changed, 96 insertions(+), 66 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2012-02-13 02:17:51 Re: [COMMITTERS] pgsql: Correctly initialise shared recoveryLastRecPtr in recovery.
Previous Message Alex Hunsaker 2012-02-11 09:57:04 Re: [COMMITTERS] pgsql: Add new keywords SNAPSHOT and TYPES to the keyword list in gram.