8

So, like a lot of people starting Android development with Eclipse, even with a fast machine, I notice that the emulator runs frustratingly slow.

I search SO for any tips to make it run faster and I run across this question, whose top answer suggests a couple of things, including making the AVD have more RAM. They suggest 1024MB:

enter image description here

Sounds good. But when I try to launch it, I get this:

Failed to allocate memory: 8
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

If I set it to 512MB (up from the default 256MB) it launches fine.

But why, on a Windows 7 x64 machine with 12GB of physical RAM can I not allocate 1024MB to an AVD? Is it an Eclipse limitation? Emulator limitation? Java limitation? I presume the person in that other question got it working but I've yet to figure out how and most of the responses I see elsewhere say "yeah dial it down to 512MB" which is not the answer I'm looking for.

Community
  • 1
  • 1
Tom Kidd
  • 12,830
  • 19
  • 89
  • 128
  • By any chance, are you running a 32-bit Eclipse/Java? … which could limit you to 3G of total RAM for that process, under Windows, I believe? – BRPocock Jan 13 '12 at 16:18
  • @BRPocock: yes, I'm running 32-bit Eclipse, since the "Installing the SDK" page said to use that version (or at least I think it did, can't find reference to that now). Is there a way to use 64-bit Eclipse? – Tom Kidd Jan 13 '12 at 16:34
  • it just return `Failed to allocate memory: 8` if you run it from console ... i did few tests like running emulator with a lot of free memory(without others application) ... results are still the same ... i think the answer is ... sorry, you have to live with that :) – Selvin Jan 13 '12 at 16:36
  • I vaguely expect that this is going to be related to http://stackoverflow.com/questions/171205/java-maximum-memory-on-windows-xp — I expect you're hitting the 1.5-1.8GiB maximum for a 32-bit Java heap … – BRPocock Jan 13 '12 at 17:46
  • @BRPock - I rather doubt that, as the Android emulator is not a java program. Nor is it part of Eclipse (Eclipse merely launches it, and talks to it). However, it's entirely possible that it has been built for windows hosts as a 32-bit program - would have to check the documentation for a given release. – Chris Stratton May 22 '13 at 17:06
  • Here is the way to allocate more memory to your AVD : http://androiddevnotes.com/2011/03/08/1299521520000.html – Bourbon Jan 13 '12 at 16:13
  • Well, that article is about using Android-x86, which *can* be used for app development, but it is not as good as an AVD. – Force Jan 13 '12 at 16:16
  • this link has nothing to android emulator ... it's about running android-x86 on virtual box – Selvin Jan 13 '12 at 16:17
  • @Selvin: well apparently there is a way to get abd to connect to virtualbox, but the issue is that no one's figured out how to get android-x86 to boot up at the screen resolutions needed to make phone development feasible. Would be excellent for tablet development though. – Tom Kidd Jan 13 '12 at 16:31

6 Answers6

8

From Galaxy s3 emulator:

There is a common problem when setting up the AVD that you have to manually edit the config file to fix. File is located at C:\Documents and Settings\username\.android\avd\name_of_avd.avd\config.ini

Change the memory settings from

hw.ramSize=1024

to

hw.ramSize=1024MB

(Do not enable word wrap in notepad).

Save the file and reopen the avd. This worked for me.

Community
  • 1
  • 1
user2005091
  • 91
  • 1
  • 2
  • 1
    Note: in a now deleted answer (which should have been converted to a comment here rather than simply deleted), user2271132 suggested that it might need to be "1024M" rather than "1024MB". I have not confirmed this but wanted to add that idea to the record where everyone can see it. – Chris Stratton May 22 '13 at 17:10
2

Weird, but this worked for me on Windows 7 x64 machine with 16GB of RAM. You do have to add MB at the end of "hw.ramSize" in config.ini. I had the same problem like OP wrote. Also, if you need 2 gigabytes of RAM, write 2048MB and simulator will run from Eclipse.

0

On Windows, emulating RAM greater than 768 may fail depending on the system load enter image description here

Mohamed El-Nakeep
  • 6,580
  • 4
  • 35
  • 39
0
  1. Open C:\Users\your user.android\avd\yourAVD.avd\config.ini
  2. change

    hw.ramSize=1024

to

hw.ramSize=1024M

this worked for me :-) hope it will help!

user2617470
  • 341
  • 3
  • 16
0

I have the same problem occasionally, and I'm unable to tell you exactly why this problem occurs, but it seems that the AVD won't start if it has been allocated more then an X percentage of your available RAM at the time of starting.

If you lower the given amount by just 50mb, you'll often notice it will run just fine. Or, similarly, if you close a few programs to save some RAM, it will also boot up perfectly fine.

I know it's not ideal, but I suggest to just lower the allocated RAM in small amounts until it boots up. I wish I could give a better answer but I haven't been able to find a reason myself either.

Sander van't Veer
  • 5,930
  • 5
  • 35
  • 50
0

Try starting the AVD without Eclipse to remove that Factor. This can be done by navigating to your SDK-Path/tools and open Android(.bat?) and then select the AVD manager.

I would recommend opening a command shell, navigating to the path and then run

emulator -avd AVDNAME -scale 0.7 -no-boot-anim 

You can also try starting it without the scale parameter or maybe even a lower number.

Force
  • 6,312
  • 7
  • 54
  • 85