Note that a lot of database drivers cache *everything* in memory when
you .fetchall(), fetchone() or fetchmany(x). So all those operations
consume the same amout of memory :

result = cursor.execute(...)

for i in result:
   ...

data = result.fetchall()
for i in data:
   ...

data = result.fetchone()
...

With a lot of rows it can consume a lot of memory ...

One solution is to use server side cursors, but it only works with
PostgreSQL at the moment (and you can't use server side cursors with the
ORM).

On Mon, 2008-11-10 at 05:47 -0800, joelanman wrote:
> Thanks Simon - just checked and I'm running 2.5.2 on my machines.
> 
> From experimenting - I'm not so sure I have a memory leak, so much as
> just using a lot of memory.
> 
> I didn't realise that when Python frees memory, it doesnt necessarily
> become free in Linux. I think that possibly all that's happening is
> that as more complex pages are hit, the app is using more memory -
> which is never obviously freed up in Linux.
> 
> On that note then - for simpler pages, the Apache process seem to use
> about 60mb, which goes up to around 150mb for more complex pages
> (Joined objects made up of around 3500 rows from mysql).
> 
> I'm using WSGIDaemonProcess with 8 threads - so do these figures sound
> like an alright ballpark or totally ridiculous? Is there anything I
> can do to keep memory usage down?
> > 
-- 
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: [EMAIL PROTECTED]
@biobel: http://biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to