android查看每个app的内存占用情况

adb shell dumpsys meminfo

会得到如下信息:

Currently running services:
  meminfo
-------------------------------------------------------------------------------
DUMP OF SERVICE meminfo:
Applications Memory Usage (kB):
Uptime: 5712383 Realtime: 5712383


** MEMINFO in pid 100 [android.process.acore] **
                    native   dalvik    other    total
            size:    10180     3591      N/A    13771
       allocated:     8590     2852      N/A    11442
            free:      297      739      N/A     1036
           (Pss):     2821     2360     4880    10061
  (shared dirty):     2768     4768     3936    11472
    (priv dirty):     2588     1172     2996     6756
 
 Objects
           Views:       40        ViewRoots:        1
     AppContexts:        9       Activities:        1
          Assets:        5    AssetManagers:        5
   Local Binders:       24    Proxy Binders:       17
Death Recipients:        1
 OpenSSL Sockets:        0
 
 SQL
            heap:      586          dbFiles:        0
       numPagers:        2   inactivePageKB:       45
    activePageKB:        0


** MEMINFO in pid 125 [com.android.settings] **
                    native   dalvik    other    total
            size:     4812     3203      N/A     8015
       allocated:     4733     2519      N/A     7252
            free:       78      684      N/A      762
           (Pss):      816     1421      732     2969
  (shared dirty):     2936     4900     1368     9204
    (priv dirty):      560      484      492     1536
 
 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        1       Activities:        0
          Assets:        2    AssetManagers:        2
   Local Binders:        2    Proxy Binders:       16
Death Recipients:        1
 OpenSSL Sockets:        0
 
 SQL
            heap:        0          dbFiles:        0
       numPagers:        0   inactivePageKB:        0
    activePageKB:        0


** MEMINFO in pid 1768 [com.xinmei365.wallpaper] **
                    native   dalvik    other    total
            size:    20836     8391      N/A    29227
       allocated:    18370     5639      N/A    24009
            free:      437     2752      N/A     3189
           (Pss):     5422     8735    15611    29768
  (shared dirty):     2600     4508      924     8032
    (priv dirty):     5204     5056    11412    21672
 
 Objects
           Views:      367        ViewRoots:        1
     AppContexts:        4       Activities:        3
          Assets:        2    AssetManagers:        2
   Local Binders:       37    Proxy Binders:       23
Death Recipients:        1
 OpenSSL Sockets:        0
 
 SQL
            heap:       39          dbFiles:        0
       numPagers:        2   inactivePageKB:        9
    activePageKB:        0


** MEMINFO in pid 217 [com.svox.pico] **
                    native   dalvik    other    total
            size:     4764     3203      N/A     7967
       allocated:     4659     2426      N/A     7085
            free:       92      777      N/A      869
           (Pss):      698      961      682     2341
  (shared dirty):     3024     4932     1444     9400
    (priv dirty):      412      316      412     1140
 
 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        1       Activities:        0
          Assets:        2    AssetManagers:        2
   Local Binders:        1    Proxy Binders:        5
Death Recipients:        0
 OpenSSL Sockets:        0
 
 SQL
            heap:        0          dbFiles:        0
       numPagers:        0   inactivePageKB:        0
    activePageKB:        0


** MEMINFO in pid 142 [android.process.media] **
                    native   dalvik    other    total
            size:     5792     3271      N/A     9063
       allocated:     4931     2513      N/A     7444
            free:       52      758      N/A      810
           (Pss):     1010     1493     1097     3600
  (shared dirty):     2908     4852     1164     8924
    (priv dirty):      760      684      724     2168
 
 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        4       Activities:        0
          Assets:        4    AssetManagers:        4
   Local Binders:        7    Proxy Binders:        9
Death Recipients:        0
 OpenSSL Sockets:        0
 
 SQL
            heap:      155          dbFiles:        0
       numPagers:        3   inactivePageKB:       59
    activePageKB:        0


** MEMINFO in pid 184 [com.android.email] **
                    native   dalvik    other    total
            size:     4888     3203      N/A     8091
       allocated:     4876     2666      N/A     7542
            free:       11      537      N/A      548
           (Pss):      881     1221      833     2935
  (shared dirty):     2956     4952     1308     9216
    (priv dirty):      620      544      560     1724
 
 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        2       Activities:        0
          Assets:        2    AssetManagers:        2
   Local Binders:        4    Proxy Binders:        8
Death Recipients:        0
 OpenSSL Sockets:        0
 
 SQL
            heap:       56          dbFiles:        0
       numPagers:        3   inactivePageKB:       13
    activePageKB:        0


** MEMINFO in pid 133 [com.android.alarmclock] **
                    native   dalvik    other    total
            size:     4764     3203      N/A     7967
       allocated:     4723     2575      N/A     7298
            free:       28      628      N/A      656
           (Pss):      726     1066      837     2629
  (shared dirty):     2980     4976     1296     9252
    (priv dirty):      460      392      564     1416
 
 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        1       Activities:        0
          Assets:        2    AssetManagers:        2
   Local Binders:        2    Proxy Binders:       10
Death Recipients:        1
 OpenSSL Sockets:        0
 
 SQL
            heap:       14          dbFiles:        0
       numPagers:        1   inactivePageKB:        3
    activePageKB:        0


** MEMINFO in pid 161 [com.android.mms] **
                    native   dalvik    other    total
            size:     4808     3203      N/A     8011
       allocated:     4765     2645      N/A     7410
            free:       42      558      N/A      600
           (Pss):      802     1195      849     2846
  (shared dirty):     2952     4948     1268     9168
    (priv dirty):      540      512      624     1676
 
 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        2       Activities:        0
          Assets:        2    AssetManagers:        2
   Local Binders:        2    Proxy Binders:       27
Death Recipients:        0
 OpenSSL Sockets:        0
 
 SQL
            heap:        0          dbFiles:        0
       numPagers:        0   inactivePageKB:        0
    activePageKB:        0


** MEMINFO in pid 52 [system] **
                    native   dalvik    other    total
            size:    13476     6791      N/A    20267
       allocated:     7935     4737      N/A    12672
            free:      464     2054      N/A     2518
           (Pss):     2760     6282     7747    16789
  (shared dirty):     2716     4564      952     8232
    (priv dirty):     2528     4308     4988    11824
 
 Objects
           Views:      127        ViewRoots:        6
     AppContexts:       10       Activities:        0
          Assets:        6    AssetManagers:        6
   Local Binders:       74    Proxy Binders:      114
Death Recipients:       22
 OpenSSL Sockets:        0
 
 SQL
            heap:       64          dbFiles:        0
       numPagers:        2   inactivePageKB:       21
    activePageKB:        0


** MEMINFO in pid 93 [com.android.phone] **
                    native   dalvik    other    total
            size:     5152     3847      N/A     8999
       allocated:     5073     3137      N/A     8210
            free:       78      710      N/A      788
           (Pss):     1199     2160     1109     4468
  (shared dirty):     2888     4840     1140     8868
    (priv dirty):      952     1336      860     3148
 
 Objects
           Views:        0        ViewRoots:        0
     AppContexts:        5       Activities:        0
          Assets:        3    AssetManagers:        3
   Local Binders:       31    Proxy Binders:       68
Death Recipients:        3
 OpenSSL Sockets:        0
 
 SQL
            heap:      181          dbFiles:        0
       numPagers:        2   inactivePageKB:       25
    activePageKB:        0


** MEMINFO in pid 92 [com.android.inputmethod.pinyin] **
                    native   dalvik    other    total
            size:     5860     3203      N/A     9063
       allocated:     5822     2627      N/A     8449
            free:       37      576      N/A      613
           (Pss):      946     1256     1743     3945
  (shared dirty):     2944     4932     1300     9176
    (priv dirty):      684      508     1480     2672
 
 Objects
           Views:       12        ViewRoots:        0
     AppContexts:        3       Activities:        0
          Assets:        2    AssetManagers:        2
   Local Binders:        6    Proxy Binders:       90
Death Recipients:        1
 OpenSSL Sockets:        0
 
 SQL
            heap:        0          dbFiles:        0
       numPagers:        0   inactivePageKB:        0
    activePageKB:        0


如果手机安装的app比较多的话,打印的信息会很多,可以使用

adb shell dumpsys meminfo com.***(包名)或者

adb shell dumpsys meminfo 1234(pid)

例如:

adb shell dumpsys meminfo com.xinmei365.wallpaper
Currently running services:
  meminfo
-------------------------------------------------------------------------------
DUMP OF SERVICE meminfo:
Applications Memory Usage (kB):
Uptime: 7845348 Realtime: 7845348


** MEMINFO in pid 1882 [com.xinmei365.wallpaper] **
                    native   dalvik    other    total
            size:    23884     8263      N/A    32147
       allocated:    23485     5486      N/A    28971
            free:      397     2777      N/A     3174
           (Pss):     8374     8231    18460    35065
  (shared dirty):     2604     4516     2432     9552
    (priv dirty):     8156     5228    14068    27452
 
 Objects
           Views:      437        ViewRoots:        2
     AppContexts:        4       Activities:        3
          Assets:        2    AssetManagers:        2
   Local Binders:       39    Proxy Binders:       23
Death Recipients:        1
 OpenSSL Sockets:        0
 
 SQL
            heap:       41          dbFiles:        0
       numPagers:        2   inactivePageKB:       10
    activePageKB:        0

这就是应用的内存使用情况,分析OOM很有帮助的。

更多相关文章

  1. android:installLocation简析
  2. android:installLocation简析
  3. android:installLocation简析
  4. Arcgis android - Installation error: INSTALL_FAILED_INSUFFIC
  5. android:installLocation简析
  6. 创建Android(安卓)SD卡遇到的问题
  7. android:installLocation简析
  8. ANDROID获取设备ID、型号及其它信息
  9. android 多媒体数据库详解

随机推荐

  1. mysql 5.7.17 安装教程 附MySQL服务无法
  2. Mysql占用过高CPU时的优化手段(必看)
  3. Window 下安装Mysql5.7.17 及设置编码为u
  4. mysql连接数设置操作方法(Too many conne
  5. 详解MySql的慢查询分析及开启慢查询日志
  6. MySql登陆密码忘记及忘记密码的解决方案
  7. 解决mac使用homebrew安装MySQL无法登陆问
  8. MySQL几点重要的性能指标计算和优化方法
  9. 浅谈innodb_autoinc_lock_mode的表现形式
  10. 线上MYSQL同步报错故障处理方法总结(必看