GB use more memory for Bitmap object?? (more than froyo)

34 views
Skip to first unread message

Neo

unread,
Jun 13, 2011, 8:48:21 AM6/13/11
to android-platform
I found that gb use more memory than froyo.
When we make Bitmap object, image buffer is located in native heap.
Decoder in skia library is using malloc.(for jpeg, bimap or png )
But, the size is reported to vm. So, It could influence total vm oject
creation.
In worst case, many Bitmap object could cause a out of memory
exception.

I am using same apk, but total size of native heap is different.
GB use about 30% more memory than froyo.
So, I am facing OOM exception more frequently.

I guess it is result of Bitmap change in android source
code(BitmapFactory.java).
Default loading option could influence the native heap size?

If my guessing is reasonable,
It could cause a problem when i change default option from ARGB_8888
to RGB_565?
If there is no issue, I'd like to change the default config for
Bitmap.

from Froyo (BitmapFactory.java)
public Bitmap.Config inPreferredConfig;

to GB (BitmapFactory.java)
public Bitmap.Config inPreferredConfig = Bitmap.Config.ARGB_8888;

Romain Guy

unread,
Jun 13, 2011, 1:05:45 PM6/13/11
to android-...@googlegroups.com
Gingerbread uses ARGB_8888 by default but do *not* change it. Apps
will now expect this format starting with 2.3 and this would be an
incompatible change.

> --
> You received this message because you are subscribed to the Google Groups "android-platform" group.
> To post to this group, send email to android-...@googlegroups.com.
> To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
>
>

--
Romain Guy
Android framework engineer
roma...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

Neo

unread,
Jun 13, 2011, 6:24:00 PM6/13/11
to android-platform
If apps are expect ARGB_888 by default in Gingerbread,
Is there any backward compatibility for applications developed under
2.2.
Previous application would expect RGB_565.

If this change of default option could cause a lack of memory.
Such a change is so irresponsible.

Romain Guy

unread,
Jun 13, 2011, 6:30:57 PM6/13/11
to android-...@googlegroups.com
That's why we also increased the maximum heap size in Gingerbread.

Reply all
Reply to author
Forward
0 new messages