检查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第三方库


热门话题
jframe为什么JAVA paint()方法不起作用?   java Guice:将ContainerRequestContext注入拦截器   java如何优雅地关闭Spring JMS MessageListenerAdapter   java如何在Spring中设置快照隔离级别   Java中的安卓平台独立信任存储路径   java无法在eclipse中运行hello world程序   java Sinch空指针问题   使用Java将JSON流式传输到BigQuery   java从“大数据”中选择什么Swing控件?   java通过对象字段过滤/排序集合?   java将数据从活动传递到另一个活动中的片段   java访问打包在jar文件中的文档   Java获取事件的大小。getDragboard()。getFiles()。流()。映射(文件::长度)。toString());   java Android libgdx:启动程序图标按下后,启动屏幕不会立即显示   java如何在Google App Engine灵活环境中配置oracle jdk   java有没有办法减少这些行?   Java:客户端socket不读取第二行,在终止符行之后保持打开状态   java以编程方式获取api 29上的所有APK文件   java ActionBar按钮不显示