Django Postgres memory leak
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Breezy Bay
--
Chapters
00:00 Django Postgres Memory Leak
02:26 Accepted Answer Score 6
02:58 Thank you
--
Full question
https://stackoverflow.com/questions/6097...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #multithreading #postgresql #memoryleaks
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Breezy Bay
--
Chapters
00:00 Django Postgres Memory Leak
02:26 Accepted Answer Score 6
02:58 Thank you
--
Full question
https://stackoverflow.com/questions/6097...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #multithreading #postgresql #memoryleaks
#avk47
ACCEPTED ANSWER
Score 6
Django keeps a reference to all executed queries in a ring buffer when settings.DEBUG = True
From DEBUG documentation
It is also important to remember that when running with
DEBUGturned on, Django will remember every SQL query it executes. This is useful when you’re debugging, but it’ll rapidly consume memory on a production server.
Setting DEBUG = False should address your issue.
To wipe the ring buffer in situations where it may pose a problem in development:
from django.db import reset_queries
if settings.DEBUG:
reset_queries()