如果想查看整个内存可以使用命令:
cat /proc/meninfo
查看应用程序的命令: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
查看单个应用程序内存占用量的命令: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
有了这些,调试应用程序的内存问题容易多了
来源:oschina
链接:https://my.oschina.net/u/114929/blog/109583