python模块的内存使用情况 [英] python module memory usage

查看:99
本文介绍了python模块的内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个python模块,可以导入许多其他模块.在监视模块的vm使用情况时,我看到使用情况持续增长.我尝试遍历整个代码,并尽可能将None分配给对象\变量.但是我怀疑仍然存在某些无法释放内存的问题.有没有办法(通过某些第三方模块或其他方式)查看未处理的对象或其内存消耗?

I have this python module that imports many other modules. On monitoring the vm usage of the module, I see the usage continuously growing. I tried to go through the whole code and assigned None to the objects\variables whereever possible. But I suspect there still could be something that is not freeing up the memory. Is there a way (through some 3rd party module or something) to view undisposed objects or their memory consumption?

谢谢!

推荐答案

查看推荐使用哪种Python内存配置文件?.您需要深入研究文档,但是这些工具将使您可以按模块细分内存使用情况.

Check out How do I profile memory usage in Python? and Which Python memory profiler is recommended?. You need to dig into the docs, but those tools will allow you to breakdown memory usage by module.

这篇关于python模块的内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆