再看开发过程中,经常要通过内存的使用量来优化程序。

查看应用程序的命令:adb shell procrank

显示如下:

PID      Vss      Rss      Pss      Uss  cmdline
  190   79560K   74736K   49624K   43604K  system_server
14335   55776K   55740K   31308K   26676K  com.android.launcher2
13074   47408K   47380K   24947K   22428K  com.android.settings
 7626   42060K   42028K   21312K   18432K  com.android.systemui
13948   32992K   32944K   11687K    9800K  android.process.acore
  283   25516K   25476K    8136K    7148K  com.android.phone
  422   24560K   24524K    7338K    6292K  com.android.inputmethod.pinyin
12871   25804K   25740K    6288K    4880K  com.snda.tt
  454   23672K   23616K    5735K    4544K  com.google.process.gapps
14723   25744K   25684K    5706K    4100K  com.rili.android.client
14844   23816K   23752K    4706K    3276K  com.dopid.android
14601   23980K   23920K    4686K    3432K  android.process.media
13060   22892K   22828K    4570K    3428K  com.tencent.WBlog
13303   22876K   22820K    4013K    2852K  com.android.vending
13396   21672K   21608K    3978K    2960K  com.limitfan.gojuuon
   93    4132K    4112K    3322K    3164K  /system/bin/mediaserver
  603   18732K   18668K    3274K    2476K  com.mediatek.mdlogger
  420   18676K   18616K    3033K    2220K  com.mediatek.bluetooth
14734   21744K   21680K    3010K    1868K  com.yingyonghui.market
14829   20792K   20728K    3002K    1924K  com.uucun105286.android.cms
13323   20312K   20248K    2851K    1848K  com.cootek.smartinputv5
   92   20008K   19932K    2680K    1556K  zygote
  111    2008K    2004K    1438K    1396K  /system/bin/drmserver
  105    1852K    1848K    1355K    1324K  /system/bin/em_svr
  108    1512K    1504K    1100K    1080K  /system/bin/mdpd
 7696     816K     812K     501K     468K  /system/bin/wpa_supplicant
  167     780K     776K     429K     416K  /system/bin/rild
   96     560K     556K     237K     228K  /system/bin/mtkbt
   84     484K     480K     234K     224K  /system/bin/vold
   85     576K     572K     229K     216K  /system/bin/netd
    1     284K     284K     210K     172K  /init
  103     424K     420K     200K     196K  /system/bin/mtk_agpsd
  150     420K     416K     192K     188K  /system/bin/gsm0710muxd
  151    1036K     508K     181K     172K  /system/bin/mdlogger
   91     516K     512K     173K     164K  /system/bin/dm_agent_binder
  110     184K     184K     164K     164K  /sbin/adbd
   80     388K     384K     162K     156K  /system/bin/aee_aed
  106     496K     492K     161K     152K  /system/bin/nvram_agent_binder
14682     416K     412K     141K     132K  /system/bin/dhcpcd
14873     356K     348K     139K     132K  /system/bin/sh
   88     372K     368K     136K     128K  /system/bin/hald
  100     368K     364K     129K     124K  /system/bin/installd
   99     340K     336K     120K     116K  /system/bin/atci
   87     348K     344K     116K     112K  /system/bin/mobile_log_d
   64     152K     152K     114K      76K  /sbin/ueventd
 7689     340K     336K     110K     104K  /system/bin/debuggerd
   86     324K     320K     109K     104K  /system/bin/netdiag
  353     316K     312K      96K      92K  /system/xbin/mnld
   94     284K     276K      92K      88K  /system/bin/dbus-daemon
  146     272K     268K      92K      88K  /system/bin/memsicd
   97     368K     276K      87K      84K  /system/bin/ccci_fsd
  102     268K     260K      87K      84K  /system/bin/keystore
14681     312K     304K      81K      72K  /system/bin/logwrapper
   83     256K     248K      75K      72K  /system/bin/servicemanager
   95     252K     244K      75K      72K  /system/bin/6620_launcher
 7694     272K     264K      73K      68K  /system/bin/logwrapper
  109     232K     224K      66K      64K  /system/bin/sh
   98     236K     228K      59K      56K  /system/bin/ccci_mdinit

注:
VSS - Virtual Set Size 虚拟耗用内存(包含共享库占用的内存)
RSS - Resident Set Size 实际使用物理内存(包含共享库占用的内存)
PSS - Proportional Set Size 实际使用的物理内存(比例分配共享库占用的内存)
USS - Unique Set Size
进程独自占用的物理内存(不包含共享库占用的内存)

查看单个应用程序内存占用量的命令:adb shell dumpsys meminfo $包名 或者 $进程号
//当然你也可以adb shell进去后在输入余下部分。

显示如下:

Applications Memory Usage (kB):
Uptime: 70102403 Realtime: 104776333

** MEMINFO in pid 14335 [com.android.launcher2] **
                    native   dalvik    other    total
            size:    27576     8455      N/A    36031
       allocated:    26850     5311      N/A    32161
            free:      385     3144      N/A     3529
           (Pss):    13830     1134    16034    30998
  (shared dirty):     2980     1932    13776    18688
    (priv dirty):    13736      184    12504    26424
 
 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        0       Activities:        0
          Assets:        3    AssetManagers:        3
   Local Binders:      162    Proxy Binders:       81
Death Recipients:        1
 OpenSSL Sockets:        0
 
 SQL
               heap:     3063         MEMORY_USED:     3063
 PAGECACHE_OVERFLOW:     2266         MALLOC_SIZE:       50
 
 DATABASES
      pgsz     dbsz   Lookaside(b)  Dbname
         1     2544            500  launcher.db

有了这些,调试应用程序的内存问题容易多了

Android 查看内存使用状况的更多相关文章

  1. 在Eclipse中使用MAT分析Android程序内存使用状况(转)

    对于Android这种手持设备来说,通常不会带有太大的内存,而且一般用户都是长时间不重启手机,所以编写程序的时候必须要非常小心的使用内存,尽量避免有内存泄露的问题出现.通常分析程序中潜在内存泄露的问题 ...

  2. Android 查看内存

    文章参照自:http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-a ...

  3. Android中如何查看内存

    文章参照自:http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-a ...

  4. Android中如何查看内存(上)

    文章参照自:http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-a ...

  5. Android内存管理(5)*官方教程:Logcat内存日志各字段含义,查看当前内存快照,跟踪记录内存分配,用adb查看内存情况时各行列的含义,捕获内存快照的3种方法,如何让程序暴漏内存泄漏的方法

    Investigating Your RAM Usage In this document Interpreting Log Messages                 内存分析日志中各消息的含 ...

  6. 查看JVM内存使用状况

    1.jps:查看本地正在运行的java进程和进程ID(pid) 2.jinfo pid,查看指定pid的所有JVM信息 1)jinfo -flags pid 查询虚拟机运行参数信息. 2)jinfo ...

  7. android手机测试中如何查看内存泄露

    (一) 生成.hprof文件生成.hprof 文件的方法有很多,而且Android 的不同版本中生成.hprof 的方式也稍有差别,我使用的版本的是2.1,各个版本中生成.prof 文件的方法请参考: ...

  8. Android 通过adb shell命令查看内存,CPU,启动时间,电量等信息

    Android 通过adb shell命令查看内存,CPU,启动时间,电量等信息   by:授客 QQ:1033553122 1.  查看内存信息 1)查看所有内存信息 命令: dumpsys mem ...

  9. Android 通过adb shell命令查看内存,CPU,启动时间,电量等信息

    1.  查看内存信息 1)查看所有内存信息 命令: dumpsys meminfo 例: C:\Users\laiyu>adb shell shell@android:/ $ dumpsys m ...

随机推荐

  1. compilation filed Unable to write to path xxxxxx 遇到这种情况的话

    如果是xib文件的话 查看target —>Build Phases —> Copy Bundle Resources里面查看路径. 可能有重复路径导致编译不通过.

  2. Lintcode: Sort Colors II

    Given an array of n objects with k different colors (numbered from 1 to k), sort them so that object ...

  3. SQL in查询

    --sal为员工工资 select * from emp;

  4. Nginx简单配置

    Nginx 配置文件结构如果你下载好啦,你的安装文件,不妨打开 conf 文件夹的 nginx.conf 文件,Nginx 服务器的基础配置,默认的配置也存放在此.在 nginx.conf 的注释符号 ...

  5. 01分数规划POJ2976(简单模板题)

    Dropping tests Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7276   Accepted: 2523 De ...

  6. ServiceController1

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  7. fzu 2188 过河I

    http://acm.fzu.edu.cn/problem.php?pid=2188 过河I Time Limit:3000MS     Memory Limit:32768KB     64bit ...

  8. Java基础(42):Java中主类中定义方法加static和不加static的区别(前者可以省略类名直接在主方法调用,后者必须先实例化后用实例调用)

    package lsg.ap.april4th2; /* 知识点:1.Getter and Setter 的应用 2.局部变量与成员变量(也可叫做全局变量) 3.Static关键字的用法 a.成员变量 ...

  9. .NET: 防止多个应用程序同时开

    用到了Mutex这个类,直接看代码~ using System; using System.Collections.Generic; using System.Linq; using System.W ...

  10. Android深入浅出之Binder机制

    一说明 Android系统最常见也是初学者最难搞明白的就是Binder了,很多很多的Service就是通过Binder机制来和客户端通讯交互的.所以搞明白Binder的话,在很大程度上就能理解程序运行 ...