Android: Track number of objects created

两盒软妹~` 提交于 2019-12-03 10:36:34

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!