diff options
| author | Bruce Momjian <bruce@momjian.us> | 2002-09-26 05:23:26 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2002-09-26 05:23:26 +0000 |
| commit | b2c34e2bd1f48fe3aa1c9e5365e1eca9b0748b64 (patch) | |
| tree | 2ce5767377d8e6e2c668e80ee90ee36f54c3879c /src/pl/plpython/plpython.c | |
| parent | 5ad4faf13ac0d0fed39ee15915839ec6215776a2 (diff) | |
| download | postgresql-b2c34e2bd1f48fe3aa1c9e5365e1eca9b0748b64.tar.gz | |
I have attached the pltcl patch again, just in case. For the sake of clarity
let's say this patch superscedes the previous one.
I have also attached a patch addressing the similar memory leak problem in
plpython. This includes a slight adjustment of the tests in the source
directory. The patch also includes a cosmetic change to remove a compiler
warning although I think the change makes the code look worse though.
BTW, by my reckoning the memory leak would occur with prepared plans and
without. If that is not the case then I've been barking up the wrong tree.
Nigel J. Andrews
Diffstat (limited to 'src/pl/plpython/plpython.c')
| -rw-r--r-- | src/pl/plpython/plpython.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c index ca739ad74c..2192ede4c7 100644 --- a/src/pl/plpython/plpython.c +++ b/src/pl/plpython/plpython.c @@ -29,7 +29,7 @@ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.22 2002/09/04 22:51:23 petere Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.23 2002/09/26 05:23:26 momjian Exp $ * ********************************************************************* */ @@ -408,7 +408,9 @@ plpython_call_handler(PG_FUNCTION_ARGS) else PLy_restart_in_progress += 1; if (proc) + { Py_DECREF(proc->me); + } RERAISE_EXC(); } @@ -1841,7 +1843,14 @@ PLy_plan_dealloc(PyObject * arg) * * FIXME -- leaks saved plan on object destruction. can this be * avoided? + * I think so. A function prepares and then execp's a statement. + * When we come to deallocate the 'statement' object we obviously + * no long need the plan. Even if we did, without the object + * we're never going to be able to use it again. + * In the against arguments: SPI_saveplan has stuck this under + * the top context so there must be a reason for doing that. */ + pfree(ob->plan); } if (ob->types) PLy_free(ob->types); @@ -2374,6 +2383,8 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, int rows, int status) PyList_SetItem(result->rows, i, row); } PLy_typeinfo_dealloc(&args); + + SPI_freetuptable(tuptable); } RESTORE_EXC(); } |
