Hi,

I bet that Motorola has android 2.1 or 2.1.-update1

I'm fed up of OOM problems with these, and have not found a solution
after lot of tries, including changing several bitmaps by graphic
primitives drawn on the fly to use less memory, so I just assumed that
there is something I must live with.

On the other hand, at least in my cases and I think in most of the
cases, if you cannot load these bitmaps your application cannot work
properly, so there is no way of handling such situation that may be
better than the crash itself.

Anyway your bitmap seems to be too big. What resolution are you using?
SGSII has 800x480 pixels, that means that you need about to 1536000
bytes for storing a full screen bitmap as ARGB_8888, but you are
requesting more than the double, a waste of space. And if you are doing
the same with several bitmaps, it is A LOT of wasted memory.

Regards,


On 16/07/12 14:23, B.Arunkumar wrote:
> Hi,
>
>    We have an app which renders bitmaps on imageview. On Samsung
> Galaxy, it works fine. But On Motorola Droid, it runs into memory
> issues and crashes every now and then with the following logcat.
>
> /dalvikvm-heap( 3640): 3686400-byte external allocation too large for
> this process.
> E/GraphicsJNI( 3640): VM won't let us allocate 3686400 bytes
> W/dalvikvm( 3640): threadid=11: thread exiting with uncaught exception
> (group=0x4001d7e0)
> E/AndroidRuntime( 3640): FATAL EXCEPTION: Thread-25
> E/AndroidRuntime( 3640): java.lang.OutOfMemoryError: bitmap size
> exceeds VM budget
> E/AndroidRuntime( 3640):      at
> android.graphics.Bitmap.nativeCreate(Native Method)
> E/AndroidRuntime( 3640):      at
> android.graphics.Bitmap.createBitmap(Bitmap.java:468)
> E/AndroidRuntime( 3640):      at
> com.example.OnVRViewer.RTPClient.ProcessFrame(RTPClient.java:419)
> E/AndroidRuntime( 3640):      at
> com.example.OnVRViewer.RTPClient.ProcessRtpVideoPacket(RTPClient.java:
> 204)
> E/AndroidRuntime( 3640):      at
> com.example.OnVRViewer.RTSPUDPclient.AdvanceProcess(RTSPUDPclient.java:
> 659)
> E/AndroidRuntime( 3640):      at
> com.example.OnVRViewer.RTSPUDPclient.processSelectionKey(RTSPUDPclient.java:
> 726)
> E/AndroidRuntime( 3640):      at
> com.example.OnVRViewer.RTSPUDPclient.run(RTSPUDPclient.java:2068)
> E/AndroidRuntime( 3640):      at java.lang.Thread.run(Thread.java:1096)
> W/ActivityManager( 1081):   Force finishing activity
> com.example.OnVRViewer/.AsyncRecordTrial
>
> My question is even though we have a try catch on Bitmap.createBitmap
> it is still crashing. Why is the catch block not working? And how do
> we handle the exception without crashing on Motorola Droid.
>
> Following is my code right now:
>
> try
> {
>       bm = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
> }
> catch (Exception ex)
> {
>       android.util.Log.e("Bitmap", "Error");
> }
>
> Thank you,
> B.Arunkumar
>


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

Reply via email to