在shell环境使用命令
dumpsys meminfo
得到如下信息:
Applications Memory Usage (kB):
Uptime: 5696643 Realtime: 9312875
Total PSS by process:
65448 kB: com.android.launcher (pid 627)
48572 kB: system (pid 389)
30549 kB: com.android.systemui (pid 491)
14920 kB: com.anyisheng.doctoran:service (pid 4108)
10548 kB: com.google.process.gapps (pid 699)
7991 kB: com.android.phone (pid 593)
7765 kB: com.sohu.inputmethod.sogou (pid 579)
7745 kB: eu.chainfire.supersu (pid 4122)
7719 kB: com.msg.parser (pid 4006)
6477 kB: com.zdworks.android.pad.zdclock (pid 1470)
6453 kB: com.google.process.location (pid 658)
5961 kB: com.google.android.apps.genie.geniewidget (pid 5047)
4947 kB: com.android.nfc (pid 611)
4861 kB: android.process.media (pid 4851)
3391 kB: com.android.location.fused (pid 668)
Total PSS by OOM adjustment:
48572 kB: System
48572 kB: system (pid 389)
43487 kB: Persistent
30549 kB: com.android.systemui (pid 491)
7991 kB: com.android.phone (pid 593)
4947 kB: com.android.nfc (pid 611)
65448 kB: Foreground
65448 kB: com.android.launcher (pid 627)
22685 kB: Perceptible
14920 kB: com.anyisheng.doctoran:service (pid 4108)
7765 kB: com.sohu.inputmethod.sogou (pid 579)
4861 kB: A Services
4861 kB: android.process.media (pid 4851)
48294 kB: Background
10548 kB: com.google.process.gapps (pid 699)
7745 kB: eu.chainfire.supersu (pid 4122)
7719 kB: com.msg.parser (pid 4006)
6477 kB: com.zdworks.android.pad.zdclock (pid 1470)
6453 kB: com.google.process.location (pid 658)
5961 kB: com.google.android.apps.genie.geniewidget (pid 5047)
3391 kB: com.android.location.fused (pid 668)
Total PSS by category:
90469 kB: Dalvik
67037 kB: Other dev
34923 kB: Unknown
15275 kB: .so mmap
13837 kB: Other mmap
7081 kB: .apk mmap
3652 kB: .dex mmap
993 kB: .ttf mmap
48 kB: .jar mmap
20 kB: Cursor
12 kB: Ashmem
0 kB: Native
Total PSS: 233347 kB
KSM: 0 kB saved from shared 0 kB
0 kB unshared; 0 kB volatile
adb shell进入shell环境,利用命令ps查看应用对应的进程号
radio 593 129 488612 29408 ffffffff 4016aee4 S com.android.phone
nfc 611 129 485352 25936 ffffffff 4016aee4 S com.android.nfc
u0_a29 627 129 540580 97224 ffffffff 4016aee4 S com.android.launcher
u0_a10 658 129 490956 28188 ffffffff 4016aee4 S com.google.process.location
u0_a84 668 129 466076 22456 ffffffff 4016aee4 S com.android.location.fused
u0_a10 699 129 511348 32980 ffffffff 4016aee4 S com.google.process.gapps
u0_a158 1470 129 470860 27256 ffffffff 4016aee4 S com.zdworks.android.pad.zdclock
例如闹钟com.zdworks.android.pad.zdclock对应的PID为1470,
然后利用命令
dumpsys meminfo 1470
返回
Applications Memory Usage (kB):
Uptime: 6191391 Realtime: 9807624
** MEMINFO in pid 1470 [com.zdworks.android.pad.zdclock] **
Shared Private Heap Heap Heap
Pss Dirty Dirty Size Alloc Free
------ ------ ------ ------ ------ ------
Native 0 0 0 2084 1778 153
Dalvik 3796 11172 3016 9792 9491 301
Cursor 0 0 0
Ashmem 0 0 0
Other dev 5 28 0
.so mmap 481 1904 256
.jar mmap 0 0 0
.apk mmap 285 0 0
.ttf mmap 0 0 0
.dex mmap 432 0 0
Other mmap 549 20 28
Unknown 1038 764 992
TOTAL 6586 13888 4292 11876 11269 454
Objects
Views: 0 ViewRootImpl: 0
AppContexts: 3 Activities: 0
Assets: 2 AssetManagers: 2
Local Binders: 5 Proxy Binders: 12
Death Recipients: 0
OpenSSL Sockets: 0
SQL
MEMORY_USED: 129
PAGECACHE_OVERFLOW: 16 MALLOC_SIZE: 62
DATABASES
pgsz dbsz Lookaside(b) cache Dbname
4 60 351 354/23/9 /data/data/com.zdworks.android.pad.zdclock/databases/zdclock.db
可以得到此应用的内存情况。