Search Postgresql Archives

Re: plpythonu memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux