Can't avoid GCs in simple draw loops
<p>I'm trying to test out some different methods of drawing to a Canvas, without triggering garbage collection. Even the most basic examples cause frequent gcs. Example:</p>

<pre><code>class Panel extends View {
    private int mX = 0;
    private Paint mPaint = new Paint();

    public Panel(Context context) {
        super(context);
        mPaint.setColor(0xFFFF0000);
    }

    @Override
    public void onDraw(Canvas canvas) {
        canvas.drawColor(Color.BLACK);
        canvas.drawRect(mX, 0, mX+40, 40, mPaint);
        mX++;

        postInvalidate();
    }
}
</code></pre>

<p>I get the same result with SurfaceView (lunar lander example). GCs about every 10 seconds or so, pretty jarring in a realtime game. I'm not making any allocations in the draw loop above, so something must be allocated in the canvas etc classes (unfortunately).</p>

<p>I had success with an opengl test, no gcs, but I was hoping to avoid getting into opengl. I'm pretty familiar with it, but it's going to be tough drawing some effects I wanted to achieve using opengl.</p>

<p>Thanks</p>
