Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  How to find the worst allocations in Eclipse w/ Android (Dalvik) JVM?  (Read 795 times)
0 Members and 2 Guests are viewing this topic.
Offline blahblahblahh

JGO Kernel
*****

Posts: 4575


http://t-machine.org


« on: 2011-11-20 14:24:00 »

I wrote lots of sloppy code, quickly, to get a game up and running fast.

That's great, worked fine, but now (weeks later) performance has slowed down enough it's getting annoying, and I'd like to clean things up.

First, obvious, thing: I'm getting GC freeing 1.5 MB per second. That's a lot bigger than I expected, since I'm only running at 20 FPS.

Eclipse's DDMS view has an allocation tracker, but the frequent GC's mean I don't get to see what's allocating so extensively.

Any ideas on how to catch this? Or is it just a case of "keep hitting Get Allocations button until you see something unexpected" ?

malloc will be first against the wall when the revolution comes...
Offline Catharsis

Full Member
**

Posts: 162


EGR Software rocks!


« Reply #1 on: 2011-11-20 16:40:09 »

I don't have the tools in front of me, but I dump hprof files from ddms (a button on the toolbar) then use the hprof convert tool and load them in YourKit to get a full view of allocations and such from known points when the hprof files are dumped. It's a bit laborious, but YourKit is a fantastic tool. If you are getting 1.5MB a second obviously there is a problem somewhere. It's certainly possible to have no runtime overhead on Android as in desktop Java.

Founder & Principal Architect; EGR Software LLC
http://www.typhonrt.org/
http://www.egrsoftware.com/
Offline blahblahblahh

JGO Kernel
*****

Posts: 4575


http://t-machine.org


« Reply #2 on: 2011-11-20 17:20:34 »

In the end, I just hit the "get allocations" button like crazy until something big appeared, fixed that, then repeated.

Although it felt a bit stupid, I believe this took less time than faffing around with manual DDMS dumps, manual running of the hprof converter tool (what a joke that is - "hey, we broke the standard. And, uh, we're not going to fix it. But here's a commandline tool you can use to un-break what we broke! have fun!"), etc.

(NB: I recently tried to enable the Eclipse plugin that's supposed to handle live hprofs of all kinds - it's too broken, and there are no docs, just a couple of long boring youtube videos. I gave up at that point Sad )

malloc will be first against the wall when the revolution comes...
Games published by our own members! Go get 'em!
Offline Catharsis

Full Member
**

Posts: 162


EGR Software rocks!


« Reply #3 on: 2011-11-20 17:29:55 »

Indeed. It's tedious and silly about the conversion, but the best way I've found to handle difficult to find issues. YourKit has been a good friend for many years. When you are bleeding as much as you are presently the current way you are searching for things works.

Founder & Principal Architect; EGR Software LLC
http://www.typhonrt.org/
http://www.egrsoftware.com/
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.056 seconds with 19 queries.