我在这里关注了如何在Django上进行大量设置的出色文章:http : //www.toofishes.net/blog/using-guppy-debug-django-memory-leaks/
我已经命令了hp.setref(),现在过了一会儿我也通过hp.heap()获得了数据:
>>> hp.heap()
Partition of a set of 12075 objects. Total size = 1515496 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 4048 34 339656 22 339656 22 str
1 3112 26 269368 18 609024 40 tuple
2 171 1 169992 11 779016 51 dict (no owner)
3 1207 10 144440 10 923456 61 list
4 49 0 102040 7 1025496 68 dict of module
5 591 5 66984 …Run Code Online (Sandbox Code Playgroud)