On Jun 18, 2008, at 9:59 AM, Arun Kumar PG wrote:
> hi all folks, > > i have a search form that allows user to search for records. i am > eager loading 4 attributes on the master object which results in 4 > left outer joins in the sa's sql query. the problem is that when i > look at the memory consumption using top command it looks crazy. > > the memory shoots up by 50-60 MB instantly (some times even 100+ > MB). i executed the query on db directly and the results are > returned in 3 secs (close to around 60,000 rows). sa is spending a > good amount of time processing the results and while it is doing > that i see abnormal memory growth. also the cpu is used almost 98% > during this time. > > the interesting thing is that after processing the request the > memory does not comes down. it stays there only. i dont know why its > not gc'ed. > > my environment: > - mysql 4.1 > - sa 3.9 > - python 2.4 > > is there any chance that memory is getting leaked as i don't see > memory come down even after some time. > The Session in 0.3 does not lose references to any data loaded automatically, it has to be cleaned out manually using session.expunge(obj) or session.clear(). From 0.4 on forward the Session is weak referencing so that unreferenced, clean objects fall out of scope automatically. 0.4 also eager loads many rows about 30% faster than 0.3 and 0.5 is then about 15% faster than 0.4. ORMs in general are designed for rich in-memory functionality and are not optimized for loads of many tens of thousands of rows, so for better performance overall consider non-ORM access to these rows. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---