[android] Failed to allocate memory: 8

From today, when I tried to run an app in NetBeans on a 2.3.3 Android platform, it shows me that:

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.

and the Emulator doesn't want to start.

This is for the first time when I see it, and google has no asnwers for this, I tried even with 2 versions of NetBeans 6.9.1 and 7.0.1, still the same error.

This question is related to android netbeans android-emulator

The answer is


In my case, changin screen resolution from WVGA720 to WSVGA works for me.


Referring to Android: failed to allocate memory and its first comment under accepted answer, changing "1024" to "1024MB" helped me. Pathetic, but works.


I solved by put as storage size 2 times the RAM size, and by putting the SD storage size the same as RAM size.


I have 16 GB and a 3.4 Ghz quad core proc in my machine. The virtual machine won't let me run it at 1024 either. I did bump it up to 878MB because it failed at 880 with the same message. This seems to be the most ram I can allocate to the emulator. It is still slow but I'm assuming it is better than 512MB.


I change my monitor DPI settings from the launch options of AVD and synchronized it with the original and current setting of my monitor, and it worked.


Looks like there are a thousand different fixes for this...none of the above worked for me, but what worked was to launch the AVD from the command line emulator-arm.exe @AVD-NAME

Somehow if launched with only emulator.exe, I would get the same error message than when trying to launch via Eclipse.


Be sure that IntelHAXM is installed correctly. It's not enough to download and "install" it through the SDK Manager. You need to manually install it from:

android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager

Also, be sure that Intel Virtual Technology is enabled in your BIOS.

Follow the guide on developer.android.com or Intel's installation instructions.


What worked for me on Windows was:

1) Closing Eclipse 2) Running Avd UI 3) Closing all running processes, especially ones that are heavy in memory, like Chrome, explorer.exe, etc 4) Start the emulator 5) Win


The problem is in memory fragmentation. OS have to allocate all the ram you specified for vm ( say 1Gb) as one continuous block. Sometimes there is no such block. To fix it close running programs, then run avd and start your virtual machine.


In my case:

  • Using built in WXGA720 to simulate 720p device, always got this error
  • Manually set AVD resolution to 720 x 1280, works for me

hope it helps~


Everything else you read here and elsewhere is pure conjecture. The only sure-way to fix this problem is vote for this bug report.

The problem isn't related to emulator resolution or OpenGL, nor how much memory your computer has. I've got 24GB memory in my computer and most of the time I run with hw.ramSize=1024 I get error 8. Other times it works just fine without any configuration changes. I hope you caught that: I did not alter the emulator configuration at all and yet sometimes it runs and sometimes it fails.

There is a high probability it has something to do with memory fragmentation. I recommend reducing the value of hw.ramSize as a temporary workaround.


I realized the solution to this problem stems from Eclipse memory allocation when you run the application in normal mode. I just checked the "Run as Administrator" box under the shortcut properties for Eclipse and now it allows me to allocate more memory for the AVD.

Hope that helps.


I noticed it was related to just one avd all the rest of the ones I have worked fine. I deleted it and created a new one and now it works.


Have a look at the official issue 33930. There is pointed out, that it may have to do with the start up of OpenGL during the start of the emulator. Others wrote it only crashes when they use WXGA800-skin and suggest to manually set the resolution to 800x1280.

Further there are ZIP-files provided to manually downgrade your android SDK to version 19 and plattform-tools to version 11. This may help as well to temporally fix the issue.


I have overcome this problem by changing the device screen size.

I have found that if you are specifying 1024 mb ram then you have to specify the device screen size in hdpi only and if it is 512 mb ram then it should be mdpi or others.

So, We can clearly say that ram size should be specify according to the screen size . If you are specifying the 1024 ram size while keeping the device screen size in mdpi then it results in the above mentioned error i.e "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."

or

make your options in AVD manager as follows:

[2013-01-11 14:44:01 - SDK Manager] hw.sensors.orientation=yes

[2013-01-11 14:44:01 - SDK Manager] hw.camera.front=none

[2013-01-11 14:44:01 - SDK Manager] hw.gps=yes

[2013-01-11 14:44:01 - SDK Manager] skin.dynamic=no

[2013-01-11 14:44:01 - SDK Manager] hw.keyboard=no

[2013-01-11 14:44:01 - SDK Manager] vm.heapSize=32

[2013-01-11 14:44:01 - SDK Manager] hw.ramSize=343


You only need to edit your virtual device's ram, making it lower! Try 20 MB, and it will work!


I went through all the other solutions mentioned on this thread and didn't find anything that was working so I dinked around a little. The Google version of the API was failing on me for some reason. I changed it back to the vanilla and no more crashes.

I must have some other issue but maybe this will help somebody...


Works with 512 Mb instead. None of the above methods works for me.


I had the same issue but before I got the issue it asked me to capture a video source.

I disabled the camera support and I was able to use 1024MB of RAM.

Using Windows 64bit, Xoom (Android 3.0).


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to netbeans

Can't create project on Netbeans 8.2 I'm getting favicon.ico error Cannot find java. Please use the --jdkhome switch Netbeans 8.0.2 The module has not been deployed Error starting Tomcat from NetBeans - '127.0.0.1*' is not recognized as an internal or external command Cannot start GlassFish 4.1 from within Netbeans 8.0.1 Service area javac: invalid target release: 1.8 connecting MySQL server to NetBeans Starting of Tomcat failed from Netbeans Display Records From MySQL Database using JTable in Java

Examples related to android-emulator

flutter run: No connected devices How to remove the Flutter debug banner? Android Studio AVD - Emulator: Process finished with exit code 1 Android Studio Emulator and "Process finished with exit code 0" Run react-native on android emulator ERROR Android emulator gets killed Error while waiting for device: Time out after 300seconds waiting for emulator to come online Unfortunately Launcher3 has stopped working error in android studio? updating Google play services in Emulator Android Studio emulator does not come with Play Store for API 23