Larry Martell <larry.mart...@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

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to