Android:分配内存失败

2024-05-15

我正在尝试创建一个具有 2047 mb 内存的模拟器。 当我运行它时,我收到此错误:

[2011-02-22 14:24:14 - Emulator]
[2011-02-22 14:24:14 - Emulator] This application has requested the Runtime to terminate it in an unusual way.
[2011-02-22 14:24:14 - Emulator] Please contact the application's support team for more information.
[2011-02-22 14:24:26 - Emulator] Failed to allocate memory: 8

我知道降低数字会使其发挥作用。但我宁愿拥有更多的内存,这样我就可以测试我正在开发的游戏。我假设有更多的内存,它会运行得更快......

有人在模拟器上有 2047 mb 的内存吗?如果是这样,怎么办?您使用了什么设置?您对计算机进行过任何特殊更改吗?

使用windows 7 64位,更新到最新的android sdk。我还有超过 8GB 的​​可用内存。我确实有一个设备(摩托罗拉里程碑)要测试,但是由于它是一款基于网络的游戏,除了我的手机之外,我还需要至少一个其他客户端(希望使用模拟器)来运行。


运行更快的模拟器的解决方案:

http://androiddevnotes.com/2011/03/08/1299521520000.html http://androiddevnotes.com/2011/03/08/1299521520000.html

运行我的游戏速度更快,与手机质量相当。

-- 2012 年 8 月 24 日更新 --

我看到人们仍然来这里评论这个答案,我对这个问题做了更多的研究。我向您展示我的发现结果。

NOTE:这些测试是在我的计算机上运行的,您的计算机可能有所不同。

  1. 运行属性“Device ram size”= 2048 的 Android 2.2 (armeabi) 模拟器将 失败,就像以前一样
  2. Running an Android 2.2 (armeabi) emulator with Property 'Device ram size' = 2048 MB will pass, however if you actually check the ram on the device, its around 128 MB.
    • 检查 1:设置 > 应用程序 > 运行服务 - 添加屏幕底部的所有数字
    • 检查 2:在 adb shell 中运行以下命令:cat /proc/meminfo/并注意MemTotal field
  3. Running an Android 4.1 (armeabi-v7) emulator with Property 'Device ram size' = 2048 will work, however if you actually check the ram on the device its around 512 MB
    • 检查 1:设置 > 应用程序 > 运行选项卡 - 添加屏幕底部的所有数字
    • 检查 2:在 adb shell 中运行以下命令:cat /proc/meminfo/并注意MemTotal field
  4. 运行 Android 4.1 (armeabi-v7) 模拟器,属性“Device ram size”= 2048MB也可以工作,但结果与 3 相同。

结论

Adding 'MB'正如下面的一些评论中所述,可能会允许您的设备启动,但它不会actually有 2 GB RAM。即使使用 4.1 模拟器,RAM 大小也为 512 MB。

推荐

请使用实际设备进行测试。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android:分配内存失败 的相关文章

随机推荐