memory usage analysis

1、Check system overall memory

1-1 adb shell cat /proc/meminfo

insert image description here

1-2 adb shell dumpsys meminfo

insert image description here
insert image description here

Total memory distribution info

total PSS = cached pss + used pss (cached pss : adj >=900 process pss sum , used pss : adj <900 process pss sum)
total kernel = cached kernel + kernel
cached kernel : slab reclaimable + buffers + cached - mapped
kernel : slab unreclaimable + shmem + vmalloc + page tables + kernel stack

1-3 adb shell procrank

insert image description here

2 Check single process memory

2-1 adb shell dumpsys meminfo $pid

insert image description here
insert image description here
Java heap:
Grab hprof to check heap distribution
Native heap:
Use malloc debug + adb shell am dumpheap $pid to check
insert image description here

2-2 adb shell system/bin/showmap $ pid

list memory detail of a process ,the data was collected from smaps
insert image description here

2-3 adb shell cat /proc/$pid/smaps

list memory detail of a process

3 Memory tracking by mlog

3-1 how to get mlog

/d/mlog : cat /d/mlog will update periodically(1s)
/d/dmlog : the last mlog (about last ~30s mlog)(it is also SYS_MEMORY_LOG in SWT/ANR/NE db)

3-2mlog format

insert image description here

3-3 use TfMA tool to parsing mlog (get this tool from submit e-service request)

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/wzx311/article/details/130438085