Thank you very much, that was exactly what I was looking for... I had always just used the eclipse plugin and never thought to try the stand alone tool. DDMS was very helpful and I was pleasantly surprised to see that it even gave me the line number of my code where the allocations were happening.
It turns out that I was building the top message string (Level # Lives # Score #) every time the onDraw was called and that was doing a lot of allocating char buffers. Now I just build the string whenever the data has changed, so once ever few seconds rather than 30+ times a second. I have not had a single garbage collection related stutter since then probably because I am calling System.gc() whenever the state of the game has changed (lost a life, end of game, advancing level) Thanks again, I am sure the users of my game will greatly appreciate this bug fix ---Sean Catlin www.snctln.com On Feb 7, 1:27 pm, Romain Guy <[email protected]> wrote: > Hi, > > It's pretty easy. Launch the tool called DDMS (the standalone one, not > the one that comes with the Eclipse plugin.) Inside the tool, go to > the Allocations Tracker tab. Click Start Tracking, use your app a > little, then click Get Allocations. You will get a list of all > allocations with, for each one of them, the stack trace to the > allocation. > > > > On Sat, Feb 7, 2009 at 9:48 AM, snctln <[email protected]> wrote: > > > I am having an issue with my latest game (available in the market as > > "BreakTheBlocks Lite") > > > This is a simple "arcade" style game, It started with a thread > > controlling the game loop but now I just have a runnable that performs > > the game loop functions and then posts back to itself. > > > In its original release there was a noticeable "stutter" in the game > > every other second or so. After a great deal of time debugging I > > finally realized that every time the stutter happened LogCat showed > > that garbage collection was taking place. > > > I went through my code and got rid of creating as many "temporary" > > objects as possible. After that the stutter went from happening every > > 1.5 seconds to happening every 13-16 seconds. This is much better, > > but I can't seem to reduce the time any further. > > > According to LogCat the garbage collector is still running on my game > > thread every 15 seconds I see the message "GC freed 19833 objects / > > 878848 bytes in 131ms"... and since my game runs at about 30 frames a > > second a 131 millisecond stutter causes about 4 frames to be dropped > > which is an annoyance for me and the users of my game. > > > So my question is What can I do to further debug this problem? I have > > always known garbage collection existed but I have never bothered to > > care about it until now because it is finally affecting the > > performance of my app (and I am a C++ programmer by day so I usually > > forget about the GC) > > > Is there any way to see what the garbage collector is collecting? Is > > there any way that I can tweak the behavior of the GC for my app? > > > Sorry for the long winded question and thank you in advance for any > > responses > > -- > Romain Guy > Android framework engineer > [email protected] > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

