As a rule of thumb: everything you have to use the new operator for to
get a hold of it is going to get garbage collected at some point. Note
that this is also true for primitive arrays like int[], float[] etc.
Local primitive type variables within methods don't need to get
garbage collected.

On 19 Mrz., 02:58, snctln <catlin.s...@gmail.com> wrote:
> I know this may be a dumb question, but my background is more in c++
> and managing my own memory.
>
> I am currently cutting down every single allocation that I can from
> one of my games to try and reduce the frequency of garbage collection
> and perceived "lag", so for every variable that I create that is an
> Object (String for example) I am making sure that I create it before
> hand in my constructor and not create temporary variables in simple 10
> line functions... (I hope that makes sense)
>
> Anyways I was working though it some more tonight and I realized that
> I a may be completely wrong about my assumption on garbage collection
> and primitive types (int, boolean, float) are these primitive type
> variables that I create in a 10 line function that gets called 20
> times a second adding to my problem of garbage collection?
>
> Thank you for any responses.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to