How big is drawable/domo2048?
Is it 4MPixel. This means that, in the best scenario, it occupies 8Mbytes. 
Then, depending on how you show it, you have a scaled (down) version of the 
image as well.

Note that the memory held by the raw data of the image (the 8Mbytes if 
RGB_565 is used) is not 'seen' by the DalvikVM. This causes the DalvikVM not 
to call the garbage collector when it actually should (DalvikVM thinks the 
memory limit has not yet been reached to warrant a call to the garbage 
collector, because it doesn't 'see' the 8MByte of your image).

This means that even if there is 8Mbyte available but not in one contiguous 
chunk of memory, you may get an out-of-memory error.

Try this: in onDestroy, set the background-drawable of the ImageView with 
id=R.id.domo2048 to null and call System.gc(). See if your memory issues get 
any less.

As a side note:
Don't assign 4MPixel images to small screens. You'll be waisting a LOT of 
memory. :)
Pre-scale the image to one that would fit on the phone with the largest 
screen that you support, not any bigger than that.


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to