Re: [android-developers] Re: stopping the GC from kicking in

2010-10-20 Thread Miguel Morales
No, it's not wrong.  It's just the best way of avoiding GC runs in your code.

A game is not like most software out there.  A lot of the time modern
design patterns have to be thrown out the window just for performance
and usability.

Sure it would be nice if the GC were faster and more efficient (and I
guess it is after 1.5).  In the end, you'll end up with the same tips
and tricks he gave you.
Also, it really isn't THAT hard.  Google does it in just about every
app they have and every class they have also has a buffered version.


On Tue, Oct 19, 2010 at 11:43 PM, Peter Webb r.peter.w...@gmail.com wrote:
  The first thing I recommend watching is this google 
 presentation:http://www.google.com/events/io/2009/sessions/WritingRealTimeGamesAnd...

 I think the advice given in this video is basically wrong.

 It is a presentation done by a C++ programmer who has just written his
 first Java program. His idea of managing GC lag is to not instantiate
 any classes at all in real-time sections of the code. He spends a
 great deal of time explaining how difficult that is.

 This flies in the face of modern software design, which says build it
 right then build it fast. He basically says throw away most of the
 benefits of using auto-GC languages such as Java by writing your code
 in a very artifical way which avoids allocating memory.

 It is a pity because he could have told us some things we (or at least
 I) don't know, such as how the GC is triggered, whether it is device
 dependent, whather there are calls to suspend repacking the heap,
 practical stuff about how to best use a GC language for real-time
 apps. Trying to avoid anything at all which might cause GC to happen
 is throwing the baby out with the bathwater.

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



-- 
~ Jeremiah:9:23-24
Android 2D MMORPG: http://developingthedream.blogspot.com/,
http://www.youtube.com/user/revoltingx

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


Re: [android-developers] Re: stopping the GC from kicking in

2010-10-19 Thread Miguel Morales
Sometimes, on devices such as a G1 there is still a GC that occurs
once around every minute due to background system services.
However, there is plenty you can do in your own code to avoid GC runs.
 The first thing I recommend watching is this google presentation:
http://www.google.com/events/io/2009/sessions/WritingRealTimeGamesAndroid.html


On Tue, Oct 19, 2010 at 4:09 PM, fadden fad...@android.com wrote:
 On Oct 19, 2:11 pm, kk kkostia...@gmail.com wrote:
 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...

 In the stand-alone DDMS there is an allocation tracker tab.  Select
 your game, click start tracking, and after fiddling with your game
 for a bit, click get allocations.  It shows the most recent 512
 allocations, with sizes and stack traces, so you can see exactly
 what's using memory.

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



-- 
~ Jeremiah:9:23-24
Android 2D MMORPG: http://developingthedream.blogspot.com/,
http://www.youtube.com/user/revoltingx

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


Re: [android-developers] Re: stopping the GC from kicking in

2010-10-19 Thread Dianne Hackborn
On Tue, Oct 19, 2010 at 6:16 PM, Miguel Morales therevolti...@gmail.comwrote:

 Sometimes, on devices such as a G1 there is still a GC that occurs
 once around every minute due to background system services.


Those GCs are not in your process; as of 1.6 such GCs in a background
process can not together take more than ~10% of the CPU from any foreground
process that wants to run.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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