Created
August 30, 2011 13:47
-
-
Save narfdotpl/1180921 to your computer and use it in GitHub Desktop.
memory leak in a Django app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source of a massive memory leak in a Django app (if obj is QuerySet): | |
if not obj: | |
return None |
@aerosol: if this will do as context... ;)
This is an oddity I don't understand (I don't know why evaluated queryset wouldn't get GCed), but unfortunately I don't have time to examine it in laboratory conditions. All I can tell is that it was inside a helper function called from a view, which was passing paginator.object_list
as obj
.
For 99% leak was caused by applying not
operator to a QuerySet
instance:
# no leak
return None
if not obj:
return None
# leak
if not obj:
return None
return None
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how come? context?