by gregholland · 16y ago · 0 comments
Currently, the Garbage Collector in Dalvik is a total piece of shit. When the GC runs, your game can freeze for up to 100-200ms, totally kills the gaming experience. What most developers who code in Java does is to use object pool and manage memory manually, its a huge pain in the butt.
If you are a C++ developer using the NDK, you are in for a world of pain as well, you can't control EGL context from C++, you can't receive events, can't play/mix sound, can't access assets (easily). To do all of these, you are stuck with using a JNI layer, which just decrease performance.
On top of that, current devices with similar hardware specs (1ghz snapdragon, wvga screen) are all fill-rate limited to 30fps.
I'm not too familiar with it, so here's a few links:
Here's a post which attempts to walk through some RenderScript sample code: http://www.inter-fuser.com/2009/11/android-renderscript-more...
Here's a mention of it on Guy Romain's blog http://www.curious-creature.org/2010/01/07/nexus-one-live-wa...
How is this different from C++? Oh yeah, instead of objects you get "big blocks of RAM".
Fortunately, there has been plenty of research on GCs that are fast enough for games. So the solution is to use one of those for Android, now that people are actually interested in writing games.
A better GC was already mentioned by the OP as another option.