先安裝相關包
pip install pyrasite
pip install guppy3
pip install mem_top
使用top查看pip
使用pyrasite連接進程
pyrasite-shell pid
兩種方式打印內存信息:
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查看進程內存佔用