Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
288 views
in Technique[技术] by (71.8m points)

Android: failed to allocate memory

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

  1. Running an Android 2.2 (armeabi) emulator with Property 'Device ram size' = 2048 will fail, just as before
  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.
    • 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
  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
    • 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
  4. 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...