heapy shows what kind of objects are junk the most memory. I don't know if heapy can show the names of those variables.
I tried to put a regular heapy dump into SABnzbd. As bpsmeter shows it output regularly, I tried putting it there, but that impacted the SAB download to go down to zero download. And I had to put a "from guppy import hpy" there too (in SABnzbd.py alone was not enough), so bpsmeter.py has its own scope? And if so, it will no see the real stack?
@shypike: how can I make SABnzbd to call heapy() each x minutes?
Code: Select all
from guppy import hpy
h = hpy()
print h.heap()
a = [1,2,3]
for x in range(1000000):
# print x
a.append(x)
heapdump = h.heap()
print heapdump
Code: Select all
sander@R540:~/heapy-spul$ time python test.py
Partition of a set of 25934 objects. Total size = 3307064 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 11830 46 923512 28 923512 28 str
1 5848 23 471784 14 1395296 42 tuple
2 346 1 271600 8 1666896 50 dict (no owner)
3 69 0 213624 6 1880520 57 dict of module
4 1632 6 208896 6 2089416 63 types.CodeType
5 177 1 197016 6 2286432 69 dict of type
6 1595 6 191400 6 2477832 75 function
7 199 1 177008 5 2654840 80 type
8 124 0 135328 4 2790168 84 dict of class
9 1044 4 83520 3 2873688 87 __builtin__.wrapper_descriptor
<90 more rows. Type e.g. '_.more' to view.>
Partition of a set of 1025810 objects. Total size = 35432688 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 1000092 97 24002208 68 24002208 68 int
1 177 0 8151624 23 32153832 91 list
2 11832 1 923640 3 33077472 93 str
3 5847 1 471720 1 33549192 95 tuple
4 352 0 273280 1 33822472 95 dict (no owner)
5 69 0 213624 1 34036096 96 dict of module
6 1632 0 208896 1 34244992 97 types.CodeType
7 177 0 197016 1 34442008 97 dict of type
8 1594 0 191280 1 34633288 98 function
9 199 0 177008 0 34810296 98 type
<90 more rows. Type e.g. '_.more' to view.>
real 0m14.177s
user 0m14.020s
sys 0m0.080s
sander@R540:~/heapy-spul$