Re: plpythonu memory leak

Поиск
Список
Период
Сортировка
От Daniel Popowich
Тема Re: plpythonu memory leak
Дата
Msg-id 19765.42463.580394.669919@io.astro.umass.edu
обсуждение исходный текст
Ответ на Re: plpythonu memory leak  (Alex Hunsaker <badalex@gmail.com>)
Ответы Re: plpythonu memory leak
Список pgsql-general
Alex Hunsaker writes:
> FYI if I don't use a slice copy here I can't get it to leak. ( find my
> test case at the end ) I don't know enough about python to know if
> thats a pl/python issue or python doing what its told--  having never
> really wrote any python myself.
>
> ---------------
> -- leaks big time
> CREATE  or replace FUNCTION pygaps_leak() RETURNS void
>    LANGUAGE plpythonu
>    AS $$
> results = plpy.execute("""select generate_series(0, 1000000)""")
> prev = results[0]
> for curr in results[1:]:
>   prev = curr
> return
> $$;
>
> -- does not leak
> CREATE  or replace FUNCTION pygaps_no_leak() RETURNS void
>    LANGUAGE plpythonu
>    AS $$
> results = plpy.execute("""select generate_series(0, 1000000)""")
> prev = results[0]
> for curr in range(1, len(results)):
>   prev = curr
> return
> $$;

Alex,

Great find!  Yes, it's definitely leaking when taking a slice.
Something is hanging on to the reference to the slice object and/or
the reference count is not properly managed: I modified your "leak"
function and added explicit calls to the python garbage collector with
no result.

I'll hunt around in the source for the leak.  Regardless of my
findings, I'll submit a bug.

Thanks!

Dan Popowich


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

Предыдущее
От: Xiaobo Gu
Дата:
Сообщение: postgresql-9.0.2-1-windows_x64 from EnterpriseDB can't install on Win 7 home basic 64 bit
Следующее
От: Xiaobo Gu
Дата:
Сообщение: Re: postgresql-9.0.2-1-windows_x64 from EnterpriseDB can't install on Win 7 home basic 64 bit