After
As I mentioned in the question, lost RAM Show the sample "Lost RAM" dumpsys dumpsys meminfo .
On my system, they are mostly done by ION (which changes Pmem) Ion debug is enabled with your kernel, so you can calculate your ion usage with this script: < / P>
adb shell cat / d / ion / heap / system | Pearl -ne 'chomp; If (m / ^ \ s + total \ s + (\ d +) $ /) {$ y + = $ 1} = (* / = end {printf "usage:% d KB, cache:% d KB, aggregate :% D KB ", $ y / 1024, $ X / 1024, ($ x + $ Y) / 1024} '
In fact, anyone tracked and tracked by the kernel Even the kernel page allocation will not be tracked, thus counting for the lost RAM.
After I stopped the system server, I used the second. Awk script to calculate lost RAM (dumpsys Meminfo meminfo service will be required and thus no longer work Not will), and lost RAM is following very closely the ion debug output:
# / usr / Bin / awk BEGIN {type [ "MemTotal"] = 1; Type [ "Pss Type ["memfree"] = 1; type ["cached"] = 1; type ["buffer"] = 1; type ["shamme"] = 1; type ["slab"] = 1; } ## code-generator "^ \\ s * #" #echo in # of Pss MemTotal MemFree cached buffer Shmem slab x; Do # cat & lt; & lt; EOF # / $ x: / {hash [ "$ X "] + = \ $ 2; #Next # # # # # # # # # End # Code Generator # # Start Code / Start PS: / {hash [" Pss "] + = $ 2; Next} / mem total: / {hash ["memory"] + = $ 2; Next} / MemFree: / {hash ["MemFree"] + = $ 2; Next} / Cached: / {hash ["cached"] + = $ 2; Next} / buffer: / {hash ["buffer"] + = $ 2; Next} / Shamem: / {hash ["Shamem"] + = $ 2; Next} / slab: / {hash ["slab"] + = $ 2; Next} ## end Generate codeEND {lost = 0; (Type in types) {if (type == "memTotal") {lost + = hash [type]; } And lost (lost - = hash [type];}} "print": "lost" KB \ n ";}
I deleted the kernel memory adb shell sh - C 'echo 3 & gt; / Proc / sys / vm / drop_caches'
, the results are still very close.
Comments
Post a Comment