Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68359
| From | kent@lysator.liu.se (Kent Engström) |
|---|---|
| Subject | Re: script uses up all memory |
| Date | 2014-03-14 15:10 +0100 |
| References | <CACwCsY65gpn_Zx78wquE-rmrZu10pu9GYbzWd-Y3ypzHsMb2Yw@mail.gmail.com> <CACwCsY4nxs-4WmKboA9mOwrjQjXKXmaBPTuuq0GSmjzEpA3efQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.8151.1394806137.18130.python-list@python.org> (permalink) |
Larry Martell <larry.martell@gmail.com> writes: > I figured out what is causing this. Each pass through the loop it does: > > self.tools = Tool.objects.filter(ip__isnull=False) > > And that is what is causing the memory consumption. If I move that > outside the loop and just do that once the memory issue goes away. Now > I need to figure out why this is happening and how to prevent it as > they do want to query the db each pass through the loop in case it has > been updated. Django saves a copy of every executed SQL query if it is in debug mode (if the DEBUG setting is true). See https://docs.djangoproject.com/en/dev/faq/models/#why-is-django-leaking-memory Regards, / Kent Engström, Lysator
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: script uses up all memory kent@lysator.liu.se (Kent Engström) - 2014-03-14 15:10 +0100
csiph-web