pgsql: Improve memory management for PL/Perl functions. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Improve memory management for PL/Perl functions.
Date
Msg-id E1bfFLX-0006u8-0f@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve memory management for PL/Perl functions.

Unlike PL/Tcl, PL/Perl at least made an attempt to clean up after itself
when a function gets redefined.  But it was still using TopMemoryContext
for the fn_mcxt of argument/result I/O functions, resulting in the
potential for memory leaks depending on what those functions did, and the
retail alloc/free logic was pretty bulky as well.  Fix things to use a
per-function memory context like the other PLs now do.  Tweak a couple of
places where things were being done in a not-very-safe order (on the
principle that a memory leak is better than leaving global state
inconsistent after an error).  Also make some minor cosmetic adjustments,
mostly in field names, to make the code look similar to the way PL/Tcl does
now wherever it's essentially the same logic.

Michael Paquier and Tom Lane

Discussion: <CAB7nPqSOyAsHC6jL24J1B+oK3p=yyNoFU0Vs_B6fd2kdd5g5WQ@mail.gmail.com>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6f7c0ea32f808a7dad3ec07db7e5fdf6514d2af0

Modified Files
--------------
src/pl/plperl/plperl.c | 237 +++++++++++++++++++++++++------------------------
1 file changed, 122 insertions(+), 115 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Improve memory management for PL/Tcl functions.
Next
From: Michael Paquier
Date:
Subject: Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013