我正在使用 python 的 guppy 来查看 python 程序中的堆使用情况。我愿意:
h = hpy
hp = h.heap()
print hp
Run Code Online (Sandbox Code Playgroud)
这是产生的输出:
Partition of a set of 339777 objects. Total size = 51680288 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 137974 41 17732032 34 17732032 34 str
1 93077 27 8342072 16 26074104 50 tuple
2 992 0 3428864 7 29502968 57 dict of module
3 23606 7 3021568 6 32524536 63 types.CodeType
4 23577 7 2829240 5 …
Run Code Online (Sandbox Code Playgroud)