Saturday, February 25, 2012

[android-developers] debugging some opengles android game with eclipse encountered outofmemoryerror exception

I'm trying to debug some android opengles soccer game with eclipse(my android device is Dell Streak pad). When the game enters into some match(let's say a worldcup match), the eclipse debugger takes really such a long time, and unfortunately fails with the outofmemoryerror exception.

Here is the call stack for the crash:

Thread [<1> main] (Suspended (exception OutOfMemoryError)) Bitmap.createBitmap(int, int, Bitmap$Config, boolean) line: 604 Bitmap.createBitmap(int, int, Bitmap$Config) line: 584
ActivityThread.createThumbnailBitmap(ActivityThread$ActivityClientRecord) line: 2442
ActivityThread.performStopActivityInner(ActivityThread$ActivityClientRecord, ActivityThread$StopInfo, boolean, boolean) line: 2615 ActivityThread.handleStopActivity(IBinder, boolean, int) line: 2689 ActivityThread.access$800(ActivityThread, IBinder, boolean, int) line: 122 BinderProxy(ActivityThread$H).handleMessage(Message) line: 1038 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 132 ActivityThread.main(String[]) line: 4123
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 491 ZygoteInit$MethodAndArgsCaller.run() line: 841
ZygoteInit.main(String[]) line: 599 NativeStart.main(String[]) line: not available [native method]

Daemon System Thread [<2> HeapWorker] (Suspended (exception OutOfMemoryError))BinderInternal$GcWatcher.finalize() line: 48
NativeStart.run() line: not available [native method]

Thread [<9> GLThread 10] (Suspended (exception OutOfMemoryError))GLSurfaceView$GLThread.run() line: 1188

And there is also some info with the logcat:

02-25 15:07:33.931: DEBUG/dalvikvm(17453): threadid=2: still suspended after undo (sc=1 dc=1)
02-25 15:07:33.931: DEBUG/dalvikvm(17453): GC_BEFORE_OOM freed 0K, 1% free 48888K/49159K, paused 414ms
02-25 15:07:33.931: ERROR/dalvikvm-heap(17453): Out of memory on a 62116-byte allocation.
02-25 15:07:33.931: DEBUG/dalvikvm(17453): threadid=9: still suspended after undo (sc=1 dc=1)
02-25 15:07:33.931: INFO/dalvikvm(17453): "main" prio=5 tid=1 RUNNABLE
02-25 15:07:33.931: INFO/dalvikvm(17453):   | group="main" sCount=0 dsCount=0 obj=0x4014b5c8 self=0x125f8
02-25 15:07:33.931: INFO/dalvikvm(17453):   | sysTid=17453 nice=0 sched=0/0 cgrp=default handle=-1342909336
02-25 15:07:33.931: INFO/dalvikvm(17453):   | schedstat=( 0 0 0 ) utm=249 stm=13 core=1
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.graphics.Bitmap.nativeCreate(Native Method)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.graphics.Bitmap.createBitmap(Bitmap.java:604)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.graphics.Bitmap.createBitmap(Bitmap.java:584)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.app.ActivityThread.createThumbnailBitmap(ActivityThread.java:2442)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:2615)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2689)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.app.ActivityThread.access$800(ActivityThread.java:122)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.os.Handler.dispatchMessage(Handler.java:99)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.os.Looper.loop(Looper.java:132)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at android.app.ActivityThread.main(ActivityThread.java:4123)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at java.lang.reflect.Method.invokeNative(Native Method)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at java.lang.reflect.Method.invoke(Method.java:491)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
02-25 15:07:33.931: INFO/dalvikvm(17453):   at dalvik.system.NativeStart.main(Native Method)

and so on.

I've tried to run it on my android device directly, and things seem to be all right, no crash, and takes acceptable time to load & run. I wonder if it is because the vm heap memory is not enough, so I've tried to increase vm memory value in eclipse.ini, after that I also closed the eclipse and restarted it:

--launcher.XXMaxPermSize 1024m -XX:MaxPermSize=1024m -Xms256m -Xmx1024m

But it doesn't work. Although it runs well on the device, but I need to debug the game match for breakpoints, stepping. Without the debugging, it would be very bad. Anyone who knows sth about this please help me on this.

Note: I am debugging the opengles game on a device(dell streak pad as I mentioned), so there would be no problem with the emulator doesn't support opengles. 

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment