Skip site navigation (1) Skip section navigation (2)

pgsql: Create a stack of pl/python "execution contexts".

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Create a stack of pl/python "execution contexts".
Date: 2012-03-13 17:19:27
Message-ID: E1S7VNf-0000Za-0d@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Create a stack of pl/python "execution contexts".

This replaces the former global variable PLy_curr_procedure, and provides
a place to stash per-call-level information.  In particular we create a
per-call-level scratch memory context.

For the moment, the scratch context is just used to avoid leaking memory
from datatype output function calls in PLyDict_FromTuple.  There probably
will be more use-cases in future.

Although this is a fix for a pre-existing memory leakage bug, it seems
sufficiently invasive to not want to back-patch; it feels better as part
of the major rearrangement of plpython code that we've already done as
part of 9.2.

Jan Urbański

Branch
------
master

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

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c |    7 ++-
src/pl/plpython/plpy_elog.c         |    8 ++-
src/pl/plpython/plpy_exec.c         |    8 ++-
src/pl/plpython/plpy_main.c         |  114 +++++++++++++++++++++++++++-------
src/pl/plpython/plpy_main.h         |   15 +++++
src/pl/plpython/plpy_procedure.c    |    3 -
src/pl/plpython/plpy_procedure.h    |    4 -
src/pl/plpython/plpy_spi.c          |    8 ++-
src/pl/plpython/plpy_typeio.c       |   14 ++++
9 files changed, 141 insertions(+), 40 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-03-13 17:28:20
Subject: pgsql: Fix minor memory leak in PLy_typeinfo_dealloc().
Previous:From: Robert HaasDate: 2012-03-13 13:51:54
Subject: pgsql: pgstattuple: Use a BufferAccessStrategy object to avoidcache-tr

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group