Django memory leak: possible causes?

I have a Django application that so often gets caught in a memory leak.

I don’t use big data that can overload the memory, in fact the application "eats" the memory gradually (after a week the memory goes from ~ 70 MB to 4 GB), so I suspect that the garbage collector is missing something, I'm not sure although. In addition, it seems that this increase does not depend on the number of requests.

Obvious things like DEBUG=True , leaving open files, etc., do not apply here.

I am using uWSGI 2.0.3 (+ nginx) and Django 1.4.5

I could configure wsgi to restart the server when the memory exceeds a certain limit, but I would not want to do this because this is not a solution.

Are there any well-known situations where the garbage collector "does not do its job properly"? Can he give some code examples?

Is there any uWSGI + Django configuration that can cause this?

+8
python django memory-leaks uwsgi
source share
1 answer

I did not find the exact material that I am looking for (each project is a world!), But after some tips and advice I managed to solve the problem. I share with you some links that may help if you encounter a similar problem.

django memory leaks, part I , django memory leaks, part II , Searching and fixing memory leaks in Python , Optimized script for nginx and uwsgi on ubuntu 12.04 (this is for WEB2PY, but gives some crutches via uWSGI) and Debugging memory leaks in WSGI application .

Some helpful answers / questions: Which Python memory profiler is recommended? Is there any working memory profiler for Python3 , Python and Python memory leaks: debugging memory leaks

+13
source share

All Articles