分析时遗漏内存

时间:2012-12-14 00:17:04

标签: python memory memory-leaks profiling

我正在使用heapy内存分析器来计算我的python程序中发生的内存膨胀。正如您在下面的时间轴中所看到的,时间轴中t1和t2之间的内存量,根据任务管理器报告的内容增长大约20 MB,但基于heapy只有1.6 MB。剩下的记忆在哪里?这是否表明支离破碎?如何验证哪个对象(例如CloudEntry)导致碎片?

时间表:

t1( 66 MB 专用字节任务管理器)

hpy().setrelheap()
// program runs ... 
// ...
// ..
// .

t2(私有字节任务管理器中 86 MB ):

Partition of a set of 21897 objects. Total size = 1868016 bytes.
 Index  Count   %     Size   % Cumulative  % Kind (class / dict of class)
     0    926   4   485224  26    485224  26 dict of common.cloud_entry.CloudEntry
     1   5564  25   431040  23    916264  49 str
     2   1888   9   219008  12   1135272  61 __builtin__.set
     3    388   2   203312  11   1338584  72 dict of Queue.Queue
     4   1164   5   162960   9   1501544  80 dict of threading._Condition
     5   2328  11    83808   4   1585352  85 types.BuiltinFunctionType
     6   4561  21    54732   3   1640084  88 int
     7   1172   5    44688   2   1684772  90 list
     8   1164   5    37248   2   1722020  92 threading._Condition
     9    926   4    29632   2   1751652  94 common.cloud_entry.CloudEntry
<64 more rows. Type e.g. '_.more' to view.>

0 个答案:

没有答案