检查python函数的内存使用情况

memspector的Python项目详细描述


检查python函数的内存使用情况

功能

  • 线程处理
  • 外部工具,不需要修改代码

检查memspector --help以获取命令行选项

安装

通过PIP:^{TT2}$

示例

example.py

l=[]defa():l.extend(range(100000))defb():globalll=[]a()a()b()a()b()a()

运行memspector example.py获得以下输出:

example.py:b()                                               thread: main_thread
total memory       diff
    2,940,336     -1,799,976
    2,040,440       -900,048

example.py:a()                                               thread: main_thread
total memory       diff
    1,139,848        900,400
    2,040,280        900,000
    1,140,408        900,048
    1,140,408        900,048

example.py                                                   thread: main_thread
total memory       diff
    1,133,832        906,232

错误

错误还是建议?访问issue tracker

许可证

Memspector
Copyright (C) 2015 Adam Tauber <asciimoo@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

See <http://www.gnu.org/licenses/>.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java将变量从一个类发送到另一个类   使用Java Kubernetes客户端Api部署pod   sql如何从oracle检索图像并在java框架中显示   java更改Clover检测类的位置   java安卓位置。getAccuracy()返回1   运行时。不支持Java ME 8上的exec()。还有别的选择吗?   bdd在Java中运行Cucumber时修改CucumberOptions标记   在java中将方法更改为运行时异常   构造函数类中的Java NullPointerException   java SetResizeable(false)不会阻止双击后的帧还原   java智能卡终端移除:SCARD_E_无服务卡例外   Java正则表达式和组   爪哇骑士巡回赛   端口8443上通过ssl的java Spring安全登录在使用http协议的端口8080上无法识别   java如何确定读取文件的哪一行特定行