我开发了一个复杂的程序,其中一个线程池执行许多对象计划的任务。我有记忆泄露。你知道吗
到目前为止,我已经发现使用guppy创建的对象的数量正在稳步增长,但它们并没有被销毁。我如何知道哪些物品没有被销毁/收集?你知道吗
以下是我的代码摘录:
# Memory Profiling
from guppy import hpy
import gc
class ThreadPool:
...
# Every 1 sec run:
gc.collect() # yes, this is paranoid...
print str(self.h.heap()).split('\n')[0]
结果是:
Partition of a set of 110304 objects. Total size = 15475848 bytes.
Partition of a set of 110318 objects. Total size = 15479920 bytes.
Partition of a set of 110320 objects. Total size = 15480808 bytes.
Partition of a set of 110328 objects. Total size = 15481408 bytes.
...
最后创建的对象是什么?有什么内省代码可以帮助你吗?你知道吗
谢谢你!你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐