Android: How do you get internal Total/Available memory?

萝らか妹 提交于 2019-12-01 00:29:49

df tells you about the space on file systems... ie, think of flash as 'disk'

As for adding it up... depends on what you want to know. Adding up distinct partitions is a bit dubious since they aren't exactly interchangeable. And there are other mtd partitions that don't have file systems or don't get mounted during normal operation - they contain things like bootloaders, radio firmware, the linux kernel and compressed root filesystem, and also the kernel and compressed file system for the recovery system.

You might do better to look through the kernel boot messages and see what it finds in the way of ram and mtd devices.

But then, there's also internal memory that is not accessible to the kernel and is instead used by the radio coprocessor. So if you actually want the total installed, it's probably best to read the manufacturers specifications.

Otherwise, you should stick to the memory that might conceivably be available to applications...

cat /proc/meminfo

will give you some information about the running memory, but Dalvik tends to take as much memory as possible...

To dig more into the Android memory, you should use DDMS.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!