pympler 模块

def memory_summary():
    # Only import Pympler when we need it. We don't want it to
    # affect our process if we never call memory_summary.
    from pympler import summary, muppy
    mem_summary = summary.summarize(muppy.get_objects())
    rows = summary.format_(mem_summary)
    return '\n'.join(rows)
# 打印当前内存情况
print(memory_summary())
posted @ 2021-01-12 12:00  pythoner_wl  阅读(226)  评论(0编辑  收藏  举报