Thanks for the tip! I'll give it a go.
On Jan 20, 9:03 pm, Neil <neil.wilkin...@gmx.com> wrote: > Just ran into this myself. It seems calling event.recycle() in the > motion event handler resolves it. > > Regards, > > Neil > > On Jan 6, 3:38 pm, SnowCrash <jason.poli...@gmail.com> wrote: > > > > > anybody out there got any clues on this? > > > Thanks > > > On Jan 4, 1:16 am, SnowCrash <jason.poli...@gmail.com> wrote: > > > > Hi folks, > > > > I'm running into some issues with input events andgarbagecollection, > > > 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/WritingRealTimeGamesAn...). > > > 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 isMotionEventand > > > 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 aMotionEventis 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