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

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

问题描述

我有一个设备,我确信它有 512 MB 的 RAM 内存

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.

推荐答案

我敢打赌你和我有一样的设备:Google Nexus S(或者它可能是具有类似配置的设备).这款手机有 512 MB 的物理 RAM,但其中 128 MB 被 GPU 占用.这就是为什么只有 384 MB 可供 Android 使用,这就是系统报告的数量.来自 维基百科条目:

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)(128MB 分配给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天全站免登陆