Android 什么是“;丢失的RAM”;哪个出现在Dumpsys meminfo中?
正如我在问题中提到的,丢失的RAM出现在Android 什么是“;丢失的RAM”;哪个出现在Dumpsys meminfo中?,android,android-4.4-kitkat,Android,Android 4.4 Kitkat,正如我在问题中提到的,丢失的RAM出现在Dumpsys meminfo中 Dumpsys meminfo中出现的“丢失RAM”背后的概念是什么 它在Kitkat中的意义是什么。如何回收利用 显示“丢失RAM”的示例转储系统 在我的系统中,它们主要是由离子(代替pmem)引起的。如果内核启用了离子调试,则可以使用以下脚本计算离子使用情况: adb shell cat/d/ion/heaps/system | perl-ne'chomp;if(m/pages in.*pool=(\d+)总计/){$
Dumpsys meminfo
中
在我的系统中,它们主要是由离子(代替pmem)引起的。如果内核启用了离子调试,则可以使用以下脚本计算离子使用情况:
adb shell cat/d/ion/heaps/system | perl-ne'chomp;if(m/pages in.*pool=(\d+)总计/){$x+=$1;}if(m/^\s+total\s+(\d+)$/){$y+=$1}结束{printf“使用:%d kb,缓存:%d kb;总计:%d kb”,$y/1024,$x/1024,($x+$y)/1024}'
事实上,驱动程序完成并跟踪的任何内核页面分配都不会被内核跟踪,因此会计入丢失的ram
在我停止系统服务器后,我使用另一个.awk脚本来计算丢失的ram(dumpsys meminfo将需要meminfo服务,因此不再工作),丢失的ram非常接近ION调试输出:
#!/usr/bin/awk
BEGIN {
types["MemTotal"] = 1;
types["Pss"] = 1;
types["MemFree"] = 1;
types["Cached"] = 1;
types["Buffers"] = 1;
types["Shmem"] = 1;
types["Slab"] = 1;
}
## start code-generator "^\\s *#"
#echo
# for x in Pss MemTotal MemFree Cached Buffers Shmem Slab; do
# cat << EOF
#/$x: / {
# hash["$x"] += \$2;
# next
#}
#
#EOF
# done
## end code-generator
## start generated code
/Pss: / {
hash["Pss"] += $2;
next
}
/MemTotal: / {
hash["MemTotal"] += $2;
next
}
/MemFree: / {
hash["MemFree"] += $2;
next
}
/Cached: / {
hash["Cached"] += $2;
next
}
/Buffers: / {
hash["Buffers"] += $2;
next
}
/Shmem: / {
hash["Shmem"] += $2;
next
}
/Slab: / {
hash["Slab"] += $2;
next
}
## end generated code
END {
lost = 0;
for (type in types) {
if (type == "MemTotal") {
lost += hash[type];
} else {
lost -= hash[type];
}
}
print "lost: " lost " kB\n";
}
#/usr/bin/awk
开始{
类型[“MemTotal”]=1;
类型[“Pss”]=1;
类型[“MemFree”]=1;
类型[“缓存”]=1;
类型[“缓冲区”]=1;
类型[“Shmem”]=1;
类型[“板”]=1;
}
##启动代码生成器“^\\s*#”
#回音
#对于Pss MemTotal MemFree缓存缓冲区Shmem板中的x;做
#cat It'slost=total-lost-free
,也就是说,这是会计机制无法解释的东西。我不知道“lost”这个词是否正确,但dumpsys meminfo无法理解它的用途。下面是如何使用.awk脚本:adb shell sh-c'busybox awk-f/system/bin/check-meminfo.awk/proc/*/smaps/proc/meminfo'
。请注意,您可能需要调整报价,我的亚洲开发银行已修复报价,以便adb shell sh-c“echo“hello world”
将按预期工作。
#!/usr/bin/awk
BEGIN {
types["MemTotal"] = 1;
types["Pss"] = 1;
types["MemFree"] = 1;
types["Cached"] = 1;
types["Buffers"] = 1;
types["Shmem"] = 1;
types["Slab"] = 1;
}
## start code-generator "^\\s *#"
#echo
# for x in Pss MemTotal MemFree Cached Buffers Shmem Slab; do
# cat << EOF
#/$x: / {
# hash["$x"] += \$2;
# next
#}
#
#EOF
# done
## end code-generator
## start generated code
/Pss: / {
hash["Pss"] += $2;
next
}
/MemTotal: / {
hash["MemTotal"] += $2;
next
}
/MemFree: / {
hash["MemFree"] += $2;
next
}
/Cached: / {
hash["Cached"] += $2;
next
}
/Buffers: / {
hash["Buffers"] += $2;
next
}
/Shmem: / {
hash["Shmem"] += $2;
next
}
/Slab: / {
hash["Slab"] += $2;
next
}
## end generated code
END {
lost = 0;
for (type in types) {
if (type == "MemTotal") {
lost += hash[type];
} else {
lost -= hash[type];
}
}
print "lost: " lost " kB\n";
}