Are primitive types garbage collected in Android?
Posted
by snctln
on Stack Overflow
See other posts from Stack Overflow
or by snctln
Published on 2010-03-19T02:28:41Z
Indexed on
2010/03/19
2:31 UTC
Read the original article
Hit count: 442
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 and Rect 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 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?
So a year ago every few seconds I would see a message in logcat like
GC freed 4010 objects / 484064 bytes in 101ms
Now I see that message every 15-90 seconds or so...
So to rephrase my question: Are primitive types (int, float, boolean, etc) included when seeing this message?
© Stack Overflow or respective owner