Hi folks, I'm running into some issues with input events and garbage collection, or more precisely object allocation. I am creating a game and have pretty much got my head around the OpenGL environment. I've digested all the relevant material I could find regarding performance, memory allocation etc (and watched the excellent presentation by Chris Pruett - http://code.google.com/events/io/2009/sessions/WritingRealTimeGamesAndroid.html). I've pretty much eliminated any object allocations after initial setup from my game (which is still in its infancy), but I'm still getting a bunch of GC calls, like this:
DEBUG/dalvikvm(52): GC freed 10398 objects / 880928 bytes in 139ms This is killing my frame-rate and creating a jittery experience, which is no good. Running DDMS I see that the culprit is MotionEvent and KeyEvent. Allocations like: 656 float[] 3 android.view.MotionEvent <init> 656 float[] 3 android.view.MotionEvent <init> 656 float[] 3 android.view.MotionEvent <init> 656 float[] 3 android.view.MotionEvent <init> 656 float[] 3 android.view.MotionEvent <init> (there are many more, this is just a snapshot) It seems that every time a MotionEvent is recorded, a float array is created? I am just using the onKeyDown event in the main Activity to broker the key event to my game thread. I'm also sleeping (16ms) in this method call (as per Chris Pruett's recommendation) to save in excessive notifications. Is there something special I can do to eliminate these allocations? Perhaps there is an alternate way of obtaining key events and or trackball events? (which also are a cause of several allocations) Thanks in advance... -- 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