Have you tried using hprof/jhat ?
See
http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=docs/heap-profiling.html;hb=HEAD


On Mon, May 25, 2009 at 1:02 PM, Robert Green <[email protected]> wrote:

>
> For the past 2 months of development, I've followed the android
> performance guidelines here -
> http://developer.android.com/guide/practices/design/performance.html
> - to the tee.
>
> I always cache field lookups if the field is referenced more than once
> in a method.  I was under the assumption that since the local variable
> is simply a pointer to the field, that it will be on the stack and
> will not need to be "cleaned" up, just like a local variable that is a
> primitive.  Is this correct?
>
> I'm very, very careful not to not allocate, that is, declare new
> objects in my main loop.  With that said, I'm having a problem where
> I'm having about 54200 objects GCed every 55 seconds while the game is
> running.  That translates to about 1000 objects per second, or at
> 60FPS (which my game runs at on the emulator), about 16 short-life
> objects per loop.
>
> I have absolutely scoured my code to make sure that I'm not creating
> anything.  I must be missing something though.  Here are my questions:
>
> 1)  Are local variables ever affected by GC if they never call new,
> either explicitly or implicitly?
> -- I'm asking if I have a field that is "private ArrayList<Dog>
> dogList;" and in my method, I say "ArrayList<Dog> dogList =
> this.dogList;" - that doesn't have any impact on GC, correct?  It's
> just a pointer on the stack, right?
> -- I understand that the word "new" doesn't need to be obvious because
> really any method can create something new and return it.
>
> 2)  What about local variable arrays?  Do those go in the heap (short
> lived, GC) or on the stack?
>
> 3)  I did an hprof dump but it's not giving me the information I
> need.  I'd really like to profile what is being GCed so I can figure
> out what's being allocated 16 times per tick.
>
> Thanks for all your help!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to