Re: plpython memory leak uppon empty resultsets in all versions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plpython memory leak uppon empty resultsets in all versions
Дата
Msg-id 12857.1272650988@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: plpython memory leak uppon empty resultsets in all versions  (Andres Freund <andres@anarazel.de>)
Ответы Re: plpython memory leak uppon empty resultsets in all versions  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
Andres Freund <andres@anarazel.de> writes:
> On Friday 30 April 2010 19:39:32 Tom Lane wrote:
>> Yeah.  There's a leak of the tuptable in the CATCH path, too.  Will fix.

> Yes, theres even more than that (measured it) in the error case. Will have a
> look later today.

Here's the patch I'm planning to apply --- working it back into the
back branches now.

            regards, tom lane


Index: plpython.c
===================================================================
RCS file: /cvsroot/pgsql/src/pl/plpython/plpython.c,v
retrieving revision 1.141
diff -c -r1.141 plpython.c
*** plpython.c    18 Mar 2010 19:43:03 -0000    1.141
--- plpython.c    30 Apr 2010 17:38:20 -0000
***************
*** 3147,3155 ****

                      PyList_SetItem(result->rows, i, row);
                  }
-                 PLy_typeinfo_dealloc(&args);
-
-                 SPI_freetuptable(tuptable);
              }
          }
          PG_CATCH();
--- 3147,3152 ----
***************
*** 3160,3170 ****
              if (!PyErr_Occurred())
                  PLy_exception_set(PLy_exc_error,
                         "unrecognized error in PLy_spi_execute_fetch_result");
-             Py_DECREF(result);
              PLy_typeinfo_dealloc(&args);
              return NULL;
          }
          PG_END_TRY();
      }

      return (PyObject *) result;
--- 3157,3171 ----
              if (!PyErr_Occurred())
                  PLy_exception_set(PLy_exc_error,
                         "unrecognized error in PLy_spi_execute_fetch_result");
              PLy_typeinfo_dealloc(&args);
+             SPI_freetuptable(tuptable);
+             Py_DECREF(result);
              return NULL;
          }
          PG_END_TRY();
+
+         PLy_typeinfo_dealloc(&args);
+         SPI_freetuptable(tuptable);
      }

      return (PyObject *) result;

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Claudio Freire
Дата:
Сообщение: Re: BUG #5443: Undetected deadlock situation
Следующее
От: Andres Freund
Дата:
Сообщение: Re: plpython memory leak uppon empty resultsets in all versions