I know, But sometimes it works.. Sometimes it doesnt. Why is that? Memory is fixed so that is strange.
Another problem: a user can run a lot of applications in the background. When a user tries to run my game but my game runs out of memmory .. what should i do? How should i deal with this kind of situation? 2009/5/18 Romain Guy <romain...@google.com> > > That means you ran out of memory :) > > On Mon, May 18, 2009 at 1:42 AM, TjerkW <tje...@gmail.com> wrote: > > > > Somebody tested my game (see http://spacewarsgame.wordpress.com) on a > > real device, > > however occasionaly this exception is thrown when running the main > > game Activity. > > This activity loads a lot of resources in GamePainter.<init>. > > > > (I know it is better to load resources in a separate thread, i'm > > woking on it, > > however this exception is unrelated to that (i think)) > > > > I dont now what the cause of this exception is, some VM memmory > > allocation problem. > > Is there not enough memory? If so, why does it run sometimes and other > > times not? > > > > The exception stack trace is below: > > > > > > I/ActivityManager( 52): Starting activity: Intent { > > comp={com.tjerk.spacewars/com.tjerk.spacewars.SpaceWarsActivity} } > > D/AirAttackActivity(12208): Launching Game Activity > > I/AirAttack(12208): Last conf instance: null > > D/dalvikvm(12208): GC freed 7699 objects / 269024 bytes in 111ms > > D/dalvikvm(12208): GC freed 347 objects / 14056 bytes in 84ms > > E/dalvikvm-heap(12208): 1345600-byte external allocation too large for > > this process. > > E/ (12208): VM won't let us allocate 1345600 bytes > > D/AndroidRuntime(12208): Shutting down VM > > W/dalvikvm(12208): threadid=3: thread exiting with uncaught exception > > (group=0x4000fe68) > > E/AndroidRuntime(12208): Uncaught handler: thread main exiting due to > > uncaught exception > > E/AndroidRuntime(12208): java.lang.OutOfMemoryError: bitmap size > > exceeds VM budget > > E/AndroidRuntime(12208): at > > android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) > > E/AndroidRuntime(12208): at > > android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:290) > > E/AndroidRuntime(12208): at > > android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:193) > > E/AndroidRuntime(12208): at > > android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:213) > > E/AndroidRuntime(12208): at > > com.tjerk.spacewars.GamePainter.<init>(GamePainter.java:186) > > E/AndroidRuntime(12208): at > > com.tjerk.spacewars.GameView.initialize(GameView.java:27) > > E/AndroidRuntime(12208): at > > com.tjerk.spacewars.SpaceWarsActivity.onCreate(SpaceWarsActivity.java: > > 47) > > E/AndroidRuntime(12208): at > > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: > > 1122) > > E/AndroidRuntime(12208): at > > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > > 2104) > > E/AndroidRuntime(12208): at > > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > > 2157) > > E/AndroidRuntime(12208): at > > android.app.ActivityThread.access$1800(ActivityThread.java:112) > > E/AndroidRuntime(12208): at > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581) > > E/AndroidRuntime(12208): at android.os.Handler.dispatchMessage > > (Handler.java:88) > > E/AndroidRuntime(12208): at android.os.Looper.loop(Looper.java: > > 123) > > E/AndroidRuntime(12208): at > > android.app.ActivityThread.main(ActivityThread.java:3739) > > E/AndroidRuntime(12208): at > > java.lang.reflect.Method.invokeNative(Native Method) > > E/AndroidRuntime(12208): at java.lang.reflect.Method.invoke > > (Method.java:515) > > E/AndroidRuntime(12208): at > > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run > > (ZygoteInit.java:739) > > E/AndroidRuntime(12208): at > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) > > E/AndroidRuntime(12208): at dalvik.system.NativeStart.main > > (Native Method) > > I/Process ( 52): Sending signal. PID: 12208 SIG: 3 > > I/dalvikvm(12208): threadid=7: reacting to signal 3 > > I/dalvikvm(12208): Wrote stack trace to '/data/anr/traces.txt' > > > > > > > > > -- > Romain Guy > Android framework engineer > romain...@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 > > > > -- -- Tjerk Wolterink @ GMail --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---