On Jun 12, 2012, at 7:19 AM, SweetLou wrote: > I've been developing for my Motorola XOOM and my Samsung. Have for the past > week just been debugging on the XOOM. Note that my application runs perfectly > fine on it without crashes/freezes. However on my Samsung, the device freezes > for a random amount of time for like 1 second, then actually > dies. Only output i get from debugger is The program 'Mono' has exited with > code 255 (0xff).
Two things: 1. What is the output of the following command on each of your devices? adb shell getprop dalvik.vm.heapsize I'll bet that they're not the same, and that the Xoom has a larger value than your Samsung. 2. View the Android Debug Log output: http://docs.xamarin.com/android/advanced_topics/android_debug_log I suspect that the Android Debug Log will contain GC_EXTERNAL_ALLOC messages, stating that it's run out of heap space, e.g. http://lists.ximian.com/pipermail/monodroid/2012-April/009717.html If this is correct, the solution is to reduce lifetime of the managed wrapper (if possible; it should be here) by calling Dispose(): http://docs.xamarin.com/android/advanced_topics/garbage_collection > I believe it's coming from this code snippet. My application is a image > gallery in which i fetch byte arrays from a service. > > // Code ... > //Decode the byte[] to the Bitmap > bitmap = Bitmap.CreateScaledBitmap(BitmapFactory.DecodeByteArray(byteArray, > 0, byteArray.Length, op), imageWidth, imageHeight, true); What is the lifetime of the `bitmap` instance, and does it need to live that long? Rephrased, what are you doing with it, and do you need to maintain a C# reference to it? If you're doing something akin to: bitmap = GetBitmap (); canvas.SetBitmap (bitmap); // never use bitmap again... then you should Dispose() of the bitmap ASAP: using (bitmap = GetBitmap ()) canvas.SetBitmap (bitmap); Disposing of the instance will allow Dalvik to collect the bitmap instance faster, and as Bitmap instances can be very large, allowing Dalvik to collect the Java-side data will reduce your memory footprint (and hopefully keep your app from crashing). - Jon _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid