Python: Memory leak debugging

前端 未结 7 1380
误落风尘
误落风尘 2020-12-07 16:45

I have a small multithreaded script running in django and over time its starts using more and more memory. Leaving it for a full day eats about 6GB of RAM and I start to swa

7条回答
  •  粉色の甜心
    2020-12-07 17:44

    See http://opensourcehacker.com/2008/03/07/debugging-django-memory-leak-with-trackrefs-and-guppy/ . Short answer: if you're running django but not in a web-request-based format, you need to manually run db.reset_queries() (and of course have DEBUG=False, as others have mentioned). Django automatically does reset_queries() after a web request, but in your format, that never happens.

提交回复
热议问题