It kicks in because you used storage.  Use less storage.

(Actually not as dumb as that sounds -- you often can use,  eg, a
"cache" to avoid allocating new arrays and such and instead reuse old
ones.  And be a little less careless doing substrings, creating new
arrays when "slicing" an existing one, etc.  I've seen cases where
relatively minor modifications reduced heap consumption by a factor of
ten.  (Note that the amount of heap "used" remains fairly constant or
even increases a little, but the rate of creating new objects drops.))

But, having said that, sometimes the best approach for a situation
like this is to force GC early, at a time in your program when the
pause won't be noticed.

On Oct 19, 4:11 pm, kk <kkostia...@gmail.com> wrote:
> Hi all,
>
> When the GC kicks in during my game I sometimes get a noticeable
> framerate drop, which is to be expected.
>
> In logcat I get the usual:
>    D/dalvikvm(   85): GC freed 55745 objects / 3149712 bytes in 709ms
>
> Is there any way to get more info as to what is causing this?
> I.e. what in my code is causing the GC to kick in...
>
> cheers,
> kk.

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

Reply via email to