A try catch block isn't going to handle a memory blow up at the native layer. On Jul 16, 2012 8:25 AM, "B.Arunkumar" <awsnetworkrecor...@gmail.com> 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 -- 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