From: | Daniel Popowich <danielpopowich(at)gmail(dot)com> |
---|---|
To: | Alex Hunsaker <badalex(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: plpythonu memory leak |
Date: | 2011-01-18 14:38:23 |
Message-ID: | 19765.42463.580394.669919@io.astro.umass.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Xiaobo Gu | 2011-01-18 14:53:56 | Re: postgresql-9.0.2-1-windows_x64 from EnterpriseDB can't install on Win 7 home basic 64 bit |
Previous Message | Xiaobo Gu | 2011-01-18 14:38:01 | postgresql-9.0.2-1-windows_x64 from EnterpriseDB can't install on Win 7 home basic 64 bit |