Using heapy to track down memory leaks in Django app

前端 未结 1 948
鱼传尺愫
鱼传尺愫 2021-01-06 02:35

I\'ve followed excellent post here how to setup heapy with Django: http://www.toofishes.net/blog/using-guppy-debug-django-memory-leaks/

I\'ve commanded hp.setref() a

相关标签:
1条回答
  • 2021-01-06 03:21

    I don't have any experience with heapy, but in my experience, Django (and most other Python programs) don't leak memory, but they also don't clean up memory as pristinely as some would like.

    Also, Django has settings that cause it to consume memory for diagnostic reasons. For example, setting DEBUG=True can cause it to hold on to all SQL queries, so the longer the process runs, the more memory it uses.

    UPDATE: Your problem isn't in your Python code. Look at the summary heapy is giving you: the total size of memory represented there is 1.5Mb! When Python programs truly leak, the most common cause is a leaky C extension. Do you have any C extensions that you are running under your Django process?

    0 讨论(0)
提交回复
热议问题