I am getting a \"bitmap size exceeds VM budget\" error. I have read that there is a 16MB memory limit. In this thread Romain Guy says that \"you can only allocate 16 MB of
If you're using threads, then the debugger might be the source of the problem. If you run the app under the debugger, then any threads created will still be retained by the debugger, even when they're finished running. This leads to memory errors that won't occur when the app is running without the debugger.
http://code.google.com/p/android/issues/detail?id=7979
https://android.googlesource.com/platform/dalvik/+/master/docs/debugger.html
I found the answer for your question recently.
Go to Android SDK Directory and
run sdk manager (Tools->android run this file)
In SDK manager go to Tools-->Manage AVDs
Now Android Virtual Device Manager Dialogue box is open..
in that window select your AVD and click Edit
Now in SD card section select SIZE and set 1024 MiB in Hardware section click New and select property " Maximum VM application heap Size" Now set 100 (based on your app requirement) Finally click "Edit AVD"
After edit click refresh button on sdk Manager
Now run your app in AVD your problem is solved.
Note that the heap limit is device-dependent. On a Droid or Nexus One, that limit is 24 MB (to accommodate the larger graphic resources.)
As with any Java VM, the heap memory will automatically grow to the max size. But, bitmaps are allocated outside the VM, so you don't "see" them easily in the stats. The best thing you can do is make sure you don't use large bitmaps, or scale them down using
http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html
From Eclipse you can generate a heap dump when you are on Android 1.6 or up and you can analyze the dump with Eclipse MAT.
Generally you can't control the max heap size on a real device, unless you are working with custom hardware or firmware.
There should be an article at developer.android.com on dumping the heap on 1.6, but I'm unable to find it. :(
Edit
Also, I have to mention that you can request more memory for applications by using
android:largeHeap="true"
in the manifest. But this is highly ill-adviced as most applications do not need this.