zoukankan      html  css  js  c++  java
  • Android 查看内存使用状况

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

    查看应用程序的命令: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


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

  • 相关阅读:
    进程二
    高德地图api的使用
    《架构即未来》读后感3
    三周总结
    性能战术:
    二周总结
    《 架构即未来》读后感2
    一周总结
    《架构即未来》读后感
    学生信息系统dao层
  • 原文地址:https://www.cnblogs.com/blogzhangwei/p/4059352.html
Copyright © 2011-2022 走看看