Android surfaceView still consumes memory after finishing the activity and killing the thread. Memory usage increases every time I restart my game (closing and opening). Cant figure it out :( Surface Destroyed method:
@Override
    public void surfaceDestroyed(SurfaceHolder holder){
                holder.lockCanvas();
                thread.setRunning(false);
                thread.join();
                retry = false;
                thread=null;
        }
    }
Surface created:
@Override
    public void surfaceCreated(SurfaceHolder holder)
    {
        thread = new MainThread(getHolder(), this);
        thread.setRunning(true);
        if(thread.getState() == Thread.State.NEW)
        thread.start();
}
This method finishes the activity:
private  void restart()
    {
        thread = new MainThread(getHolder(), this);
        thread.setRunning(false);
        thread=null;
            ((Activity) getContext()).finish();
    }
 
    