- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
正如我在问题中提到的,Lost RAM 出现在 Dumpsys meminfo
中。
显示“丢失 RAM”的示例 dumpsys。
Total RAM: 998096 kB
Free RAM: 574945 kB (145869 cached pss + 393200 cached + 35876 free)
Used RAM: 392334 kB (240642 used pss + 107196 buffers + 3856 shmem + 40640 slab)
Lost RAM: 30817 kB
Tuning: 64 (large 384), oom 122880 kB, restore limit 40960 kB (high-end-gfx)
最佳答案
在我的系统上,它们主要是由 ION(替代 pmem)引起的。如果您的内核启用了 ionic 调试,您可以使用此脚本计算您的 ION 使用情况:
adb shell cat /d/ion/heaps/system|perl -ne 'chomp; if (m/pages in.*pool = (\d+) total/) {$x += $1;} if (m/^\s+total\s+(\d+)$/) {$y += $1} END {printf "use: %d kb, cache: %d kb; total: %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";
}
在使用 adb shell sh -c 'echo 3 > /proc/sys/vm/drop_caches'
强制内核内存收缩后,我也再次检查了一遍, 结果还是很接近的。
关于android - Dumpsys meminfo中出现的 “Lost RAM”背后的概念是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21881122/
我正在寻找匹配 /(?=\W)(gimme)(?=\W)/gi 或类似的东西。 \W 应该是零宽度字符来包围我的实际匹配项。 也许有一些背景。我想用添加的文字填充替换某些单词(总是 \w+),但前提是
如何在不使用 Intent 连接到 VPN 服务的情况下以编程方式检测流量是否正在通过 VPN。有系统调用吗? 最佳答案 这个有效: private boolean checkVPN() {
我是一名优秀的程序员,十分优秀!