安装相关包

pip install pyrasite
pip install guppy3
pip install mem_top

使用top查看pid
使用pyrasite连接进程

pyrasite-shell pid

通过pyrasite连接进城后,两种方式打印内存信息:

from guppy import hpy
h = hpy()
h.heap()
from mem_top import mem_top
print(mem_top(limit=15,width=80))   # limit控制显示数据条数,width控制显示数据长度

也可以使用cat /proc/{pid}/status查看进程内存占用

参考:https://drmingdrmer.github.io/tech/programming/2017/05/06/python-mem.html

相关文章:

  • 2021-12-29
  • 2021-07-13
  • 2021-06-20
  • 2021-12-25
  • 2021-11-24
  • 2022-12-23
  • 2021-06-06
  • 2021-12-16
猜你喜欢
  • 2022-01-13
  • 2021-09-01
  • 2021-04-08
  • 2022-12-23
  • 2021-09-21
  • 2021-10-19
  • 2022-12-23
相关资源
相似解决方案