[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-25 Thread Peter Hansen
Allen Bierbaum wrote: On Tue, Feb 24, 2009 at 4:44 AM, Chris Miles miles.ch...@gmail.com wrote: On Feb 22, 6:08 am, Allen Bierbaum abierb...@gmail.com wrote: Python 2.5 and later will free up garbage collected memory, handing it back to the system. Previous versions of Python would never

[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-25 Thread Allen Bierbaum
I hadn't described the details be there is not much to the work around and pretty application specific. The summary is that I moved some application level filtering that was being done in python code on the results into the query so less results are returned. This saves a great deal of memory

[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-24 Thread Chris Miles
On Feb 22, 6:08 am, Allen Bierbaum abierb...@gmail.com wrote: The python process.  The number of objects seems to remain fairly controlled.  But the amount of resident memory used by the python process does not decrease.  I had expected that by calling gc.collect(2) python would reclaim any

[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-24 Thread Michael Schlenker
Allen Bierbaum schrieb: The python process. The number of objects seems to remain fairly controlled. But the amount of resident memory used by the python process does not decrease. I had expected that by calling gc.collect(2) python would reclaim any objects that could be freed and free

[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-24 Thread Allen Bierbaum
On Tue, Feb 24, 2009 at 4:44 AM, Chris Miles miles.ch...@gmail.com wrote: On Feb 22, 6:08 am, Allen Bierbaum abierb...@gmail.com wrote: The python process.  The number of objects seems to remain fairly controlled.  But the amount of resident memory used by the python process does not

[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-21 Thread Allen Bierbaum
I spent some more time and came up with a completely standalone test application. (attached) (requires SA 0.5.2 and some database backend). I have tested this with postgres and with sqlite and both of them exhibit the behavior I was talking about. Namely the memory keeps increasing and stays

[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-21 Thread Michael Bayer
are you referring to memory of the python process or number of unclaimed objects still present ? psycopg2 will buffer the full results from the database in memory before fetchone() is ever called, which will force the python process to grow to accomodate it. a python process generally

[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-21 Thread Allen Bierbaum
The python process. The number of objects seems to remain fairly controlled. But the amount of resident memory used by the python process does not decrease. I had expected that by calling gc.collect(2) python would reclaim any objects that could be freed and free all memory associated with

[sqlalchemy] Re: app memory leak - execute() with SA 0.5.2, PG 8.3, Psycopg2

2009-02-21 Thread Michael Bayer
i dont. you may want to look into using the server_side_cursors=True option we provide on the postgres dialect, which prevents psycopg2 from fully pre-fetching result sets. On Feb 21, 2009, at 2:08 PM, Allen Bierbaum wrote: The python process. The number of objects seems to remain