Awesome!  Those are the assumptions I've been working under for months
and I'm so happy that I wasn't way off on one of them!

I found that the standalone DDMS has an allocation tracker which is
exactly the tool I needed.  I immediately found my problem.  Two
problems:

1)  I keep a running score on screen.  The StringBuffer I'm using to
build this is causing all types of char[] and String allocations.  I'm
not sure what I can do about that.
2)  Calling Canvas.getMatrix() allocates a new matrix if one isn't
currently being used.  Interesting.  I'll be able to work around that.

Any ideas on what I can do about those strings?  Basically I need to
display #### Pts for the current score.

On May 25, 3:34 pm, Mark Murphy <[email protected]> wrote:
> Robert Green wrote:
> > 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?
>
> The pointer is on the stack. The ArrayList itself and its Dogs are on
> the heap.
>
> > 2)  What about local variable arrays?  Do those go in the heap (short
> > lived, GC) or on the stack?
>
> The array is on the stack. If the array is a primitive array (int[]),
> that covers everything. If the array is of objects (Dog[]), the Dog
> instances are from the heap.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Need help for your Android OSS project?http://wiki.andmob.org/hado
--~--~---------~--~----~------------~-------~--~----~
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