i have a very simple app.
:: Activity ::
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
this.setContentView(new GameView(this));
}
:: GameView ::
public class GameView extends SurfaceView implements Runnable {
final private SurfaceHolder holder;
private boolean gameRunning;
public GameView(Context context) {
super(context);
holder = this.getHolder();
gameRunning = true;
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.execute(this);
executorService.shutdown();
}
@Override
public void run() {
Thread.currentThread().setName("GameRenderThread");
while(gameRunning) {
if(!holder.getSurface().isValid()) {
continue;
}
Canvas canvas = holder.lockCanvas(null);
canvas.drawColor(Color.WHITE);
holder.unlockCanvasAndPost(canvas);
}
}
}
My problem is that the app constantly consume more and more RAM. The APP starts with 14.80 MB and consumed after 10 minutes already 14.94 MB.