博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python内存工具--Heapy
阅读量:6989 次
发布时间:2019-06-27

本文共 2851 字,大约阅读时间需要 9 分钟。

Getting started with Heapy

Usage example

The following example shows

  1. How to create the session context: hp=hpy()
  2. How to use the interactive help: hp.doc, hp.doc.doc
  3. How to show the reachable objects in the heap: hp.heap()
  4. How to create and show a set of objects: hp.iso(1,[],{})
  5. How to show the shortest paths from the root to x: hp.iso(x).sp
>>> from guppy import hpy; hp=hpy()>>> hpTop level interface to Heapy.Use eg: hp.doc for more info on hp.>>> hp.docTop level interface to Heapy. Available attributes:Anything            Nothing             Via                 isoClass               Rcs                 doc                 loadClodo               Root                findex              monitorId                  Size                heap                pbIdset               Type                heapu               setrefModule              Unity               idset               testUse eg: hp.doc.
for info on
.>>> hp.doc.docOverview documentation for top level Heapy object.Provides a listing of the available attributes.Accessing the attribute name on the doc objects gives further info, eg: >>> hp.doc.heapgives doc for the heap method when hp is the top level Heapy object.References may be embedded in the documentations. To access areference, opening up a web browser with the doc for it one can do eg: >>> hp.doc.heap[1]The reference number 0 is special. If it is provided, it is thereference to the html doc for the described object itself. So to seein the web browser the doc for the heap method one can do: >>> hp.doc.heap[0]References [0] heapy_Use.html#heapykinds.Use.doc>>> hp.heap()Partition of a set of 48477 objects. Total size = 3265516 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 25773 53 1612820 49 1612820 49 str 1 11699 24 483960 15 2096780 64 tuple 2 174 0 241584 7 2338364 72 dict of module 3 3478 7 222592 7 2560956 78 types.CodeType 4 3296 7 184576 6 2745532 84 function 5 401 1 175112 5 2920644 89 dict of class 6 108 0 81888 3 3002532 92 dict (no owner) 7 114 0 79632 2 3082164 94 dict of type 8 117 0 51336 2 3133500 96 type 9 667 1 24012 1 3157512 97 __builtin__.wrapper_descriptor<76 more rows. Type e.g. '_.more' to view.>>>> hp.iso(1,[],{})Partition of a set of 3 objects. Total size = 176 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 1 33 136 77 136 77 dict (no owner) 1 1 33 28 16 164 93 list 2 1 33 12 7 176 100 int>>> x=[]>>> hp.iso(x).sp 0: hp.Root.i0_modules['__main__'].__dict__['x']>>>

转载于:https://www.cnblogs.com/blockcipher/archive/2013/02/25/2931795.html

你可能感兴趣的文章
Yii2-核心框架代码规范
查看>>
面向对象和面向过程
查看>>
jvm常用参数设置 专题
查看>>
数字签名和数字证书
查看>>
php判断用户客户端是否是微信内置客户端
查看>>
【Codeforces 707A】Brain's Photos 水题
查看>>
webapi方式
查看>>
权限系统设计实现
查看>>
leetcode387
查看>>
j2ee log4j集中式日志解决方案logpool-v0.4发布说明
查看>>
Atitit 类库冲突解决方案 httpclient-4.5.2.jar
查看>>
企业局域网的组建
查看>>
Linux 进程详解
查看>>
apply plugin: 'idea' --- gradle idea
查看>>
JIT编译器
查看>>
jquery选择器空格与大于号、加号与波浪号的区别
查看>>
Linux下Utuntu使用
查看>>
Disque
查看>>
TinyFox v2.3.2 正式发布,跨平台的.NET OWIN WEB服务器
查看>>
Microsoft.Owin.Hosting 实现启动webapp.dll
查看>>