I'm having some trouble understanding why this code
public class BitmapAllocTest extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
byte[] b = new byte[20 * 1000 * 1000];
b = null;
Bitmap.createBitmap(2500, 2000, Bitmap.Config.ARGB_8888);
}
}
throws an OutOfMemory exception on a device with a 24mb heap limit. If
I comment out either of the allocations it runs fine. I was under the
impression that the java vm would try to garbage collect before
throwing OutOfMemory exceptions.
I suspect it having to do with android allocating the bitmaps on the
native heap.
PS. This is a clone from my stackoverflow question
http://stackoverflow.com/questions/3546635/android-bitmap-allocation-weirdness
which hasn't gotten a satisfactory answer yet.
--
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