python内存分析
2024-09-04 11:27:14
安装
首先安装memory_profiler和psutil
pip install memory_profiler
pip install psutil
在需要分析的函数前面添加装饰器@profile
@profile()
def call():
a = list()
for i in range(10000 * 100):
a .append(i)
运行call后的输出:
Line # Mem usage Increment Line Contents
283 40.1 MiB 40.1 MiB @profile
284 def call():
285 40.1 MiB 0.0 MiB a = list()
286 44.1 MiB 0.0 MiB for i in range(10000 * 10):
287 44.1 MiB 0.3 MiB a .append(i)
最新文章
- RequireJS与Backbone简单整合
- C#数据库导出(入)TXT
- CSS 行内样式 页内样式 外部样式
- yii 多模板
- SQL中获取最近的N个半年度
- Solr Schema.xml和solrconfig.xml分析(转)
- [课程相关]homework-03
- shutdown彻底关闭tomcat,以及多线程关闭
- ng-class css样式
- Notification(一个)——使用演示样本的基础知识
- [oracle]查询一个表中数据的插入时间
- 【转】【Android】1分钟不用改任何代码在Eclipse中使用AAR
- MongoDB 创建基础索引、组合索引、唯一索引以及优化
- Bootstrap之表格、表单应用
- php测试for/while/foreach循环速度对比
- Node.js中,获取req请求的原始IP
- [转]收藏的Extjs 多表头插件GroupHeaderGrid
- 前端工具Rythem介绍
- C语言中Union类型的使用方法
- .Net Mvc5Filter与权限认证扩展
热门文章
- Spring Boot 中使用 spring-boot-devtools (使用 Gradle 作为构建工具)
- GitHub最著名的20个Python机器学习项目
- Oracle10g 64位 在Windows 2008 Server R2 中的安装 DBconsole无法启动
- ORA-00346,借助_allow_resetlogs_corruption开库
- leetcode 142. 环形链表 II(c++)
- KVM/QEMU/qemu-kvm/libvirt 概念全解
- Binder进程与线程ProcessState以及IPCThreadState
- Winform 开源控件库( Sheng.Winform.Controls)
- hbase的TTL机制清除opentsdb的超时数据
- 【BASIS系列】SAP /usr/sap//DVEBMGS00满了怎么处理