Reputation: 11
I have an observation about memory leak:
PS: Even if I set FILE_UPLOAD_MAX_MEMORY_SIZE=0, which means use disk to store the files instead of using memory, I can still see a memory rise at the background.
I am using:
Does anyone know how to solve this issue ? Thanks a lot.
Upvotes: 1
Views: 1178
Reputation: 11
It turns out to be the problem of Gunicorn. Once setting the --thread, it seems like Gunicorn somehow won't release memory until all threads were used(Not sure if it is the correct term).
This could be helpful: Gunicorn Workers and Threads
Upvotes: 0
Reputation: 9446
It is impossible to tell what is causing the problem but here is a list of things you can try:
DEBUG=TRUE
Python/Django
versions if possibleWSGI
server are you using? (hopefully not the development server). Upgrade to the
newest version or try a different one and compare (for example if you are using
gunicorn
try uwsgi
or the opposite)gunicorn
has a max_requests
setting and you specify the number of requests before restarting the worker processes. Most servers have such a setting. Restarting will free memory if its leaking.If the issue persists you may need to trace the cause with a tool like tracemalloc
.
Upvotes: 1