Mapa de bits fuera de problemas de memoria

Mi problema

Tomo una foto con mi dispositivo android. Entonces decodifico esa imagen del archivo.

        Bitmap photo = BitmapFactory.decodeFile(EXTERNAL_IMAGE_PATH+File.separator+this._currentPhotoName+JPEG_FILE_SUFFIX);
        if (photo == null && data != null) 
            photo = (Bitmap) data.getExtras().get("data");
        else if (data == null && photo == null)
            Log.e("CCPhotoManager","Can't find image from file or from intent data.");

Luego verifico esa imagen y veo si debe girarse a la orientación correcta.

             try {
                ExifInterface exif = new ExifInterface(EXTERNAL_IMAGE_PATH+File.separator+this._currentPhotoName+JPEG_FILE_SUFFIX);
                int rotation = CCDataUtils.exifToDegrees(exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,ExifInterface.ORIENTATION_NORMAL));
                Log.v("CCPhotoManager", "Rotation:"+rotation);
                if (rotation > 0) {
                    photo = this.convertSavedImageToCorrectOrientation(EXTERNAL_IMAGE_PATH+File.separator+this._currentPhotoName+JPEG_FILE_SUFFIX, photo, rotation);
                }
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

Si necesita rotar llamo a este método.

public Bitmap convertSavedImageToCorrectOrientation(String filePath,Bitmap photo,int rotation) {
        Log.d("CCPhotoManager", "Changing Orientation of photo located at: "+filePath+" Rotating by:"+rotation);
        int width = photo.getWidth();
        int height = photo.getHeight();


        Matrix matrix = new Matrix();
        matrix.preRotate(rotation);

        Bitmap adjusted = Bitmap.createBitmap(photo, 0, 0, width, height, matrix, true);

        try {
               FileOutputStream out = new FileOutputStream(filePath);
               adjusted.compress(Bitmap.CompressFormat.JPEG, 100, out);
        } catch (Exception e) {
               e.printStackTrace();
        }

        return adjusted;
    }

estoy obteniendoSin memoria quejas si elconvertSavedImageToCorrectOrientation se llama en la líneaBitmap adjusted = Bitmap.createBitmap(photo,0,0,width,height,matrix,true);

Este es sólo el caso en elSamsung Galaxy S3. Funciona bien en elSamsung Galaxy Ace, HTC Hero y elSony Xperia U.

Aquí está el error.

10-17 14:33:33.950: E/AndroidRuntime(12556): java.lang.OutOfMemoryError
10-17 14:33:33.950: E/AndroidRuntime(12556):    at android.graphics.Bitmap.nativeCreate(Native Method)
10-17 14:33:33.950: E/AndroidRuntime(12556):    at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
10-17 14:33:33.950: E/AndroidRuntime(12556):    at android.graphics.Bitmap.createBitmap(Bitmap.java:551)

Es una cantidad masiva de memoria también.

10-17 14:33:33.945: E/dalvikvm-heap(12556): Out of memory on a 31961104-byte allocation.

Creo que es algo que ver con la cantidad de mapas de bits que existen, pero no estoy seguro de cómo evitar que ocurra este error.

Sé que puedes llamar.recycle(); en ellos pero no parece funcionar.

Mi pregunta

¿Cómo manejo correctamente mis mapas de bits para que no tenga este problema de OOM?

Gracias por adelantado

Respuestas a la pregunta(3)

Su respuesta a la pregunta