Android的:你如何获得内部总/可用内存? [英] Android: How do you get internal Total/Available memory?

查看:361
本文介绍了Android的:你如何获得内部总/可用内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有RAM内存和内置闪存的权利之间的区别是什么? 我可以让内存:

There's a difference between RAM memory and internal flash memory right? I can get RAM memory by:

cat /proc/meminfo

不过,我不知道如何让闪存的信息。

However, I am not sure how to get Flash memory information.

我想我知道如何获得可用内存:

I think I know how to get available memory:

ActivityManager activityManager = (ActivityManager).getSystemService(Context.ACTIVITY_SERVICE);
MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
memoryInfo.availMem;

这是否给出可用的内部闪存?

Does this give available internal Flash memory?

如何总内存?

请问以下UNIX命令,让我这个信息?

Does following unix command get me this info?

df

结果:

Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                    97744         0     97744   0% /dev
tmpfs                     4096         0      4096   0% /sqlite_stmt_journals
/dev/block/mtdblock3    174080    154372     19708  89% /system
/dev/block/mtdblock5    169728     57144    112584  34% /data
/dev/block/mtdblock4    133120     89632     43488  67% /cache
/dev/block/mtdblock4    133120     89632     43488  67% /data/dalvik-cache
/dev/block//vold/179:1
                       7970928   2358576   5612352  30% /sdcard

如果是这样,我一定要添加所有的tmpfs和放大器;为/ dev /块/的mtdblock#拿到总内存?

if so, do I have to add all tmpfs & /dev/block/mtdblock# to get total internal memory?

推荐答案

DF告诉你有关文件系统的空间......也就是说,认为闪存为盘

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

至于将它添加起来......取决于你想知道什么。加起来不同分区是有点可疑,因为它们并不完全互换。而且有没有文件系统或不获取安装的正常工作期间其他MTD分区 - 它们含有像引导程序,无线电固件,Linux内核和COM pressed根文件系统,而且内核和COM为恢复系统pressed文件系统。

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.

您可以做的更好,以期待通过内核启动信息,看看它找到的RAM和MTD设备的方式。

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...

这篇关于Android的:你如何获得内部总/可用内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆