Python脚本知道它正在使用多少内存 [英] Python script knows how much memory it's using

查看:157
本文介绍了Python脚本知道它正在使用多少内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

python脚本如何知道当前正在使用的系统内存量? (假设基于unix的操作系统)

How can a python script know the amount of system memory it's currently using? (assuming a unix-based OS)

推荐答案

如果您想了解解释器使用的总内存,请在Linux上阅读

If you want to know the total memory that the interpreter uses, on Linux, read /proc/self/statm.

如果要找出对象使用多少内存,请使用 Pympler .

If you want to find out how much memory your objects use, use Pympler.

这篇关于Python脚本知道它正在使用多少内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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