On Fri, Nov 20, 2009 at 6:32 AM, Doug Blank <doug.bl...@gmail.com> wrote: > I'm filling my Django tables with data through a regular Python > program (not through the browser). After it runs for a few hours, I > get: > > 10557896: ERROR: gramps.py: line 121: Unhandled exception > Traceback (most recent call last): > ... > event = models.Event.objects.get(handle=ref) > File "/usr/lib/python2.6/site-packages/django/db/models/manager.py", > line 120, in get > return self.get_query_set().get(*args, **kwargs) > File "/usr/lib/python2.6/site-packages/django/db/models/query.py", > line 300, in get > num = len(clone) > File "/usr/lib/python2.6/site-packages/django/db/models/query.py", > line 81, in __len__ > self._result_cache = list(self.iterator()) > File "/usr/lib/python2.6/site-packages/django/db/models/query.py", > line 238, in iterator > for row in self.query.results_iter(): > File "/usr/lib/python2.6/site-packages/django/db/models/sql/query.py", > line 287, in results_iter > for rows in self.execute_sql(MULTI): > File "/usr/lib/python2.6/site-packages/django/db/models/sql/query.py", > line 2369, in execute_sql > cursor.execute(sql, params) > File "/usr/lib/python2.6/site-packages/django/db/backends/util.py", > line 22, in execute > sql = self.db.ops.last_executed_query(self.cursor, sql, params) > File "/usr/lib/python2.6/site-packages/django/db/backends/__init__.py", > line 217, in last_executed_query > return smart_unicode(sql) % u_params > MemoryError > > The line that looks suspicious to me is the "self._result_cache = > list(self.iterator())". Does it look like that might be the problem? > I'm not manually doing anything other than adding data, changing data, > and calling .save() (eg, I'm not doing anything with transactions in > my code). > > I looked at the chapter on cache from the book: > > http://www.djangobook.com/en/beta/chapter14/ > > but I'm not sure how this is related. Although, if there was a Python > command to turn off caching while importing, that might be something > to try. > > Any ideas appreciated, > > -Doug >
Some additional data: I'm using Django 1.1 on Fedora11 with sqlite backend. I get the same kind of spiking of memory usage if I just enter: >>> Person.objects.all().delete() Memory usage continues to grow, and it doesn't seem to be able to be garbage collected. What could cause this? Anything I can set or issue to make Django clean up/use less memory? I am running out of memory, just deleting the data! Something seems to be very wrong... -Doug -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.