Android: Track number of objects created Android: Track number of objects created android android

Android: Track number of objects created


This is possible using the ddms tool that comes with Android (not the Eclipse version). Using that, look at the allocation tracker tab. You can start tracking allocations of all objects along with stack traces of where they were allocated. However, this tool can produce a -lot- of information and the particular information you want is not always easy to parse or find. If you have a version for the Sun JVM, I would recommend using the tools Kai mentioned, they are a lot more developed. If you have to do it in Android, using the allocation tracker will give you a start.


Why don't you profile the existing game code on the Sun JVM (assuming you're porting a Java game)? Then you can take advantage of JProfiler, Yourkit, etc. and see what huge set of objects are being cleared up. (Use -XX:+PrintGCDetails to see the GC runs for when to look for it.)

If it turns out to not be in the game, you've pretty painlessly figured that out, and can then turn your attention to your Android code. And unfortunately that I don't know much about.