I have a dumb simple loop
for alias in models.Alias.objects.all() :
alias.update_points()
but looking into the django QuerySet it seems to keep around a _result_cache
of all the previous results. This is eating Gigs and Gigs of my machine and eventually everything blows up.
How can I throw away all the stuff that I won't ever care about?
You should consider saving your changes back to the database.
Use the queryset's
iterator()
method to return the models in chunks, without populating the result cache: