Mick
Mick

Reputation: 7947

bitmap size exceeds VM budget - what if the device simply has too little memory?

I have an app that has been on the market a while and I have tested the app on multiple devices and played it a great many times without problems. Then recently I tested it on a rather crummy low performance device and got the dreaded "bitmap size exceeds VM budget" error on the very first run. I had this error before with a completely different app, but it only occurred after a great many repeated uses. When I researched this error at the time, I saw the the most up-ticked answers to resolving this issue were in relation to deallocation/garbage collection issues... but presumably it must be possible to run into this error without even having made any coding errors. Surely the error can occur simply by using an underpowered device?... and if it can, how would you distinguish that from a coding error?

Upvotes: 0

Views: 46

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007434

Surely the error can occur simply by using an underpowered device?

Not really. An "underpowered device" can display bitmaps, as you can tell just from the home screen. The issue is how big of an image it can display, in terms of resolution and bit depth, and how many such images you can hold in memory at once. You should be using things like getMemoryClass() on ActivityManager to see how big your heap is, then tailor your image processing to match.

Upvotes: 2

Related Questions