Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68359 > unrolled thread

Re: script uses up all memory

Started bykent@lysator.liu.se (Kent Engström)
First post2014-03-14 15:10 +0100
Last post2014-03-14 15:10 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: script uses up all memory kent@lysator.liu.se (Kent Engström) - 2014-03-14 15:10 +0100

#68359 — Re: script uses up all memory

Fromkent@lysator.liu.se (Kent Engström)
Date2014-03-14 15:10 +0100
SubjectRe: script uses up all memory
Message-ID<mailman.8151.1394806137.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web