有没有办法在Python Kivy中找到进程和整个程序使用的总内存。 即以某种方式我可以找到:
谢谢!
答案 0 :(得分:1)
Heapy是Python的内存分析器。像这样使用它:
>>> from guppy import hpy
>>> h = hpy()
>>> h.heap()
输出将是这样的:
Partition of a set of 1449133 objects. Total size = 102766644 bytes.
Index Count % Size % Cumulative % Kind (class / dict of class)
0 985931 68 46300932 45 46300932 45 str
1 24681 2 22311624 22 68612556 67 dict of pkgcore.ebuild.ebuild_src.package
2 49391 3 21311864 21 89924420 88 dict (no owner)
3 115974 8 3776948 4 93701368 91 tuple
4 152181 11 3043616 3 96744984 94 long
5 36009 2 1584396 2 98329380 96 weakref.KeyedRef
6 11328 1 1540608 1 99869988 97 dict of pkgcore.ebuild.ebuild_src.ThrowAwayNameSpace
7 24702 2 889272 1 100759260 98 types.MethodType
8 11424 1 851840 1 101611100 99 list
9 24681 2 691068 1 102302168 100 pkgcore.ebuild.ebuild_src.package
<54 more rows. Type e.g. '_.more' to view.>
这“基本上是ram中可达到的内容的快照”。我没有做很多Kivy的开发,所以我从来没有去过分析,但我认为这应该有效。
请参阅: