gpt4 book ai didi

eclipse 中的 android avd 虚拟内存设置

转载 作者:行者123 更新时间:2023-11-29 02:02:56 27 4
gpt4 key购买 nike

我想增加我的 avd 的默认虚拟内存堆大小。我正在使用 Eclipse 3.7.2 进行开发,当我创建(或编辑)一个 avd 时,我将“最大 VM 应用程序堆”设置为 64MB。如果我选择详细信息,它会确认这一点,如果我检查 config.ini 文件,我会看到“vm.heapSize=64”是正确的。问题是在运行 avd 时这实际上不是真的。

在我的应用程序中,我运行“Runtime.getRuntime().maxMemory();”,它显示 24MB!!!!

同样,

ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
int memoryClass = am.getMemoryClass();

显示 24MB

更新: 我注意到 hardware-qemu.ini 中的“vm.heapSize=24”?我将值更改为 64,但是当我启动 avd 时它又变回了 24?

更新: totalMemory() 返回 ~15MB

更新:ADT 版本为 20.0.1

更新:我已经对此进行了大量测试,使用许多不同的设置制作了许多不同的 AVD,我可以得出的结论是 AVD 或 Eclipse 有点错误并且通常不反射(reflect)设置值您输入 AVD。请注意,我制作的 AVD 设备确实反射(reflect)了 vm.heapSize=64。

最佳答案

基于此 Google 网上论坛 question我对文档的解释听起来像是这些值仅适用于您的应用程序,而不适用于整个模拟器。

我很想知道 totalMemory() 是否会返回 64m。这是 documentation .

编辑 getMemoryClass() 根据documentation :

Return the approximate per-application memory class of the current device.

这归结为我无法找到获取模拟器(设备)堆大小的编程方式。

编辑 2: 我认为您也可以在这里找到答案。 - Android How do you get total memory RAM in the device?

祝你好运。

关于eclipse 中的 android avd 虚拟内存设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11621292/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com