問題描述
我正在嘗試創建一個具有 2047 mb 內存的模擬器.當我運行它時,我得到了這個錯誤:
[2011-02-22 14:24:14 - 模擬器][2011-02-22 14:24:14 - Emulator] 此應用程序已請求運行時以不尋常的方式終止它.[2011-02-22 14:24:14 - Emulator] 請聯系應用程序的支持團隊以獲取更多信息.[2011-02-22 14:24:26 - 模擬器] 分配內存失敗:8
我知道降低數字會使它起作用.但我寧愿擁有更多的內存,這樣我就可以測試我正在開發的游戲.我假設有更多的內存,它會運行得更快......
有人在模擬器上安裝了 2047 mb 的內存嗎?如果是這樣,怎么做?您使用了哪些設置?您是否更改了計算機上的任何特別內容?
使用windows 7 64位,更新到最新的android sdk.我還有超過 8gb 的可用內存.我確實有一個設備(摩托羅拉里程碑)可以測試,但是由于它是一個基于網絡的游戲,除了我的手機之外,我還需要至少一個其他客戶端(希望使用模擬器)來運行.
運行更快的模擬器的解決方案:
http://androiddevnotes.com/2011/03/08/1299521520000.htmlp>
讓我的游戲運行速度更快,堪比手機質量.
-- 2012 年 8 月 24 日更新--
我看到仍然有人來這里評論這個答案,我對這個問題做了更多的研究.我向您介紹我的發現結果.
注意:這些測試是在我的電腦上運行的,您的電腦可能不同.
- 使用屬性設備內存大小"= 2048 運行 Android 2.2 (armeabi) 模擬器將失敗,和以前一樣
- 運行一個 Android 2.2 (armeabi) 模擬器,屬性 'Device ram size' = 2048 MB 會通過,然而如果你真的檢查設備上的 ram,它的大約 128 MB.
- 檢查 1:設置 > 應用程序 > 運行服務 - 在屏幕底部添加所有數字
- 檢查 2:在 adb shell 中運行以下命令:
cat/proc/meminfo/
并注意 MemTotal 字段
- 使用屬性設備內存大小"= 2048 運行 Android 4.1 (armeabi-v7) 模擬器將可以工作,但是如果您實際檢查設備上的內存,它大約為 512 MB
- 檢查 1:設置 > 應用程序 > 運行選項卡 - 在屏幕底部添加所有數字
- 檢查 2:在 adb shell 中運行以下命令:
cat/proc/meminfo/
并注意 MemTotal 字段
- 運行一個 Android 4.1 (armeabi-v7) 模擬器,屬性 'Device ram size' = 2048 MB 也可以,但結果與 3 相同.
結論
添加 'MB'(如下面的一些評論中所述)可能會允許您的設備啟動,但它實際上沒有 2 GB 的 RAM.即使使用 4.1 模擬器,RAM 大小也為 512 MB.
推薦
請使用實際設備進行測試.
I'm trying to create an emulator with 2047 mb ram. When I run it, I get this error:
[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
I understand that lowering the number will make it work. But I'd rather have it with more ram, so I can test a game I'm developing. I'm assuming with more ram, it would run faster...
Has anyone got 2047 mb of ram on the emulator? If so, how? What settings did you use? Did you change anything special on your computer?
Using windows 7 64-bit, updated to the latest android sdk. Also I have over 8gb of ram available. I do have one device (motorola milestone) to test on, however since it is a network-based game I need at least one other client (hoping to use the emulator) to run with in addition to my phone.
Solution to running a faster emulator:
http://androiddevnotes.com/2011/03/08/1299521520000.html
Runs my game a lot faster, comparable to phone quality.
-- Update 08/24/12 --
I see that people still come here and comment on this answer, and I have done more research on this issue. I present to you the results of my findings.
NOTE: These tests were run on my computer, your computer may be different.
- Running an Android 2.2 (armeabi) emulator with Property 'Device ram size' = 2048 will fail, just as before
- 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.
- check 1: Settings > Applications > Running Services - add all the numbers on the bottom of the screen
- check 2: run the following command in adb shell:
cat /proc/meminfo/
and note the MemTotal field
- 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
- check 1: Settings > Apps > Running tab - add all the numbers on the bottom of the screen
- check 2: run the following command in adb shell:
cat /proc/meminfo/
and note the MemTotal field
- Running an Android 4.1 (armeabi-v7) emulator with Property 'Device ram size' = 2048 MB will work as well, but with the same results as 3.
Conclusion
Adding 'MB' as noted in some of the comments below may allow your device to be launched, however it doesn't actually have 2 GB of RAM. Even with a 4.1 Emulator, the RAM Size is at 512 MB.
Recommendation
Please use an actual device for testing.
這篇關于Android:分配內存失敗的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!