Reputation: 10535
I tried adb shell top
, but it gives too much details info.
What I need is just the total available memory. How to get it via ADB?
Upvotes: 29
Views: 63549
Reputation: 469
You could also take a look at dumpsys
adb shell dumpsys meminfo
example output
Applications Memory Usage (in Kilobytes):
Uptime: 466195106 Realtime: 1351644497
Total PSS by process:
358,901K: org.mozilla.firefox (pid 28883 / activities)
...
...
...
Total PSS by OOM adjustment:
420,346K: Native
125,116K: surfaceflinger (pid 734)
43,238K: logd (pid 488)
20,419K: mm-qcamera-daemon (pid 3307)
...
...
...
Total PSS by category:
649,878K: Native
407,027K: Dalvik
241,132K: Gfx dev
178,217K: Unknown
174,912K: GL mtrack
161,148K: EGL mtrack
129,137K: .art mmap
96,374K: Dalvik Other
91,936K: .apk mmap
67,291K: .dex mmap
63,269K: .so mmap
34,888K: Stack
25,226K: .oat mmap
5,967K: Other mmap
1,617K: Other dev
1,439K: Ashmem
894K: .jar mmap
68K: .ttf mmap
8K: Cursor
0K: Other mtrack
Total RAM: 3,868,864K (status normal)
Free RAM: 1,114,394K ( 907,794K cached pss + 38,964K cached kernel + 167,636K free)
Used RAM: 3,259,174K (2,762,994K used pss + 496,180K kernel)
Lost RAM: 358,896K
ZRAM: 285,780K physical used for 1,434,012K in swap (1,442,368K total swap)
Tuning: 256 (large 512), oom 558,304K, restore limit 186,101K (high-end-gfx)
Upvotes: 18
Reputation: 48723
Why not built-in::
$ adb shell "cat /proc/meminfo"
Most phones lack free
utility and all the more buzybox. On other hand /proc/meminfo
is integral part of Linux.
Upvotes: 43
Reputation: 4781
How about using busybox
?
adb shell busybox free -m
total used free shared buffers
Mem: 741 503 237 0 5
-/+ buffers: 498 242
Swap: 0 0 0
Upvotes: 4
Reputation: 10535
The most "clean" way I found so far is adb shell vmstat
It gives the info as below:
procs memory system cpu
r b free mapped anon slab in cs flt us ni sy id wa ir
1 0 99120 55400 618680 25600 2207 4089 0 6 0 9 84 0 0
in which, the 99120
is the free memory in KB.
Upvotes: 24