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

From Tom Lane
Subject pgsql: Fix I/O-conversion-related memory leaks in plpgsql.
Date
Msg-id E1RwM2Z-0000Lv-S2@gemulon.postgresql.org
Whole thread Raw
List 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
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/a2c2bbcd286fdfe2bfe7405ea962a03759432772

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c |  167 +++++++++++++++++++++++++-----------------
1 files changed, 100 insertions(+), 67 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix oversight in pg_dump's handling of extension configuration t
Next
From: Tom Lane
Date:
Subject: pgsql: Fix I/O-conversion-related memory leaks in plpgsql.