以编程方式获取android设备的所有RAM内存,而不仅仅是分配给用户进程的内存 [英] Get android device's all RAM memory programmatically and not only what is only allocated to user processes

查看:126
本文介绍了以编程方式获取android设备的所有RAM内存,而不仅仅是分配给用户进程的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台设备,我知道它的RAM内存为512 MB

I have a device that I know for sure it has RAM memory of 512 MB

希望能够以编程方式检索此值(512 MB)。

Want to be able to retrieve this value (512 MB) Programmatically.

到目前为止,我已经在互联网上主要遇到这两种方式:

So far I have ran into predominately into these two ways on the internet:

https://stackoverflow.com/a/16143065/1521264
这给了我386 MB

https://stackoverflow.com/a/16143065/1521264 Which gives me 386 MB

以及
https://stackoverflow.com/a/23508821/1521264
这也给出了386 MB

and also https://stackoverflow.com/a/23508821/1521264 Which also gives 386 MB

我假设386 MB是用户进程可用的内存所以我想得到所有内存或其他进程的细分。

I am assuming 386 MB is the memory available to user processes so I would like to get all the memory or a breakdown of the other processes.

推荐答案

我敢打赌你有与我相同的设备:谷歌Nexus S(或者它可能是一个类似的设备组态)。这款手机拥有512 MB的物理RAM,但其中128个被GPU占用。这就是为什么Android只有384 MB可用,这就是系统报告的数量。来自维基百科条目

I bet you have the same device as I do: The Google Nexus S (or it might be a device with a similar configuration). This phone has 512 MB of physical RAM, but 128 of it is taken up by the GPU. That's why only 384 MB are available to Android, and that's the amount the system reports. From the Wikipedia entry:


Nexus S拥有512 MB RAM(移动DDR)(128 MB分配给
GPU,为操作系统免费提供384MB)

The Nexus S has 512 MB of RAM (Mobile DDR) (128MB is assigned to the GPU, leaving 384MB free for the OS)

由于这是系统可用的所有内存(而不仅仅是用户进程),因此您获得的值是正确的。

Since that's all the memory that's available to the system (not just the user processes), the value you get is correct.

这篇关于以编程方式获取android设备的所有RAM内存,而不仅仅是分配给用户进程的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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