dumpsys meminfo详解
adb shell dumpsys meminfo [pkg/pid] 可以用来查看指定进程包名的内存使用情况
dumpsys meminfo -h 帮助
meminfo dump options: [-a] [-d] [-c] [-s] [--oom] [process]
-a: include all available information for each process.
-d: include dalvik details.
-c: dump in a compact machine-parseable representation.
-s: dump only summary of application memory usage.
-S: dump also SwapPss.
--oom: only show processes organized by oom adj.
--local: only collect details locally, don't call process.
--package: interpret process arg as package, dumping all
processes that have loaded that package.
--checkin: dump data for a checkin
If [process] is specified it can be the name or
pid of a specific process to dump.
名词概念:
名词解释:
名词
说明
补充
Uptime
表示启动到现在的时长,不包含休眠的时间,单位毫秒(ms)
Realtime
表示启动到现在的时长,包含休眠的时间,单位毫秒(ms)
Native Heap
指c 中malloc出来的堆空间
扩展:c++申请的内存为native process,java申请的内存:java process
Dalvik Heap
指java中new出来的java堆空间
只是占用的虚拟内存的空间
Pss Total
指占用了真实的物理内存的空间
private dirty
指私有驻留内存
扩展:进程内存空间是虚拟内存,区分于物理内存,进程无法直接操作物理内存RAM。必要时,操作系统对其进行映射,使进程能应用到物理内存
Heap Size
指占用总内存(Heap 堆)
Heap Alloc
指在虚拟地址中分配了这么多空间
Heap Free
空闲内存
注:因为Android系统对dalvik的vm heapsize作了硬性限制,当java进程申请的java空间超过阈值时,就会抛出OOM异常(这个阈值可以是48M、24M、16M等,视机型而定)
查看单个应用最大内存限制,输入命令:getprop|grep heapgrowthlimit 得到结果该机型为192M。dalvik process 超过就会抛OOM异常
; "复制代码")
Applications Memory Usage (in Kilobytes):
Uptime: 246353123 Realtime: 292602983
** MEMINFO in pid 8410 [com.doctopia.zeroe] ** Pss Private Private SwapPss Heap Heap Heap
Total Dirty Clean Dirty Size Alloc Free /------ ------ ------ ------ ------ ------ ------ Native Heap 52421 52336 24 0 82432 61868 20563 Dalvik Heap 31844 31816 4 0 38652 30460 8192 Dalvik Other 14051 14048 0 12 Stack 3640 3640 0 28 Ashmem 80 48 0 0 Gfx dev 12848 12288 560 0 Other dev 76 0 76 0 .so mmap 2292 936 252 95 .jar mmap 0 0 0 0 .apk mmap 1642 76 1064 0 .ttf mmap 0 0 0 0 .dex mmap 6073 5860 132 4 .oat mmap 2153 0 0 0 .art mmap 2682 2408 8 82 Other mmap 312 8 184 0 EGL mtrack 432 432 0 0 GL mtrack 26160 26160 0 0 Unknown 14579 14576 0 18 TOTAL 171524 164632 2304 239 121084 92328 28755 App Summary Pss(KB) /------ Java Heap: 34232 Native Heap: 52336 Code: 8320 Stack: 3640 Graphics: 39440 Private Other: 28968 System: 4588 TOTAL: 171524 TOTAL SWAP PSS: 239 Objects Views: 821 ViewRootImpl: 2 AppContexts: 6 Activities: 3 Assets: 6 AssetManagers: 3 Local Binders: 62 Proxy Binders: 36 Parcel memory: 24 Parcel count: 98 Death Recipients: 2 OpenSSL Sockets: 25 WebViews: 1 SQL MEMORY/_USED: 279 PAGECACHE/_OVERFLOW: 76 MALLOC/_SIZE: 62 DATABASES pgsz dbsz Lookaside(b) cache Dbname 4 24 38 1254/33/7 /data/user/0/com.doctopia.zeroe/databases/sensorsdata 4 60 136 141/56/20 /data/user/0/com.doctopia.zeroe/databases/bugly/_db/_
Asset Allocations
zip:/data/app/com.doctopia.zeroe-1/base.apk:/resources.arsc: 972K
; "复制代码")
其他常用服务信息查询