I get OutOfMemory when I have a lot of free space. I don't understand why. In my app I have a simple flow:
- Navigate to "take picture" functionality
- Take picture and display a thumbnail
- Resize and save taken picture (resize without Picasso help)
- Repeat 2 and 3 a few times
- Send taken pictures over the network.
Bellow is shown memory usage diagram for above steps. Everything work perfect. No OutOfMemory occurred.
But I've noticed one thing. A flow:
- Just before "take picture" functionality I have a menu. When I'm constantly switching orientation of the screen then memory usage increases (~2MB per switch).
- Take picture and display a thumbnail. Picture is taken but Picasso doesn't dispaly a thumbnail. I see that Picasso nicely handles OutOfMemory and doesn't stop the application.
java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeStream - Resize and save causes the same OutOfMemory (
java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeStream) and stops the application
On the first diagram I see that "picture processing" takes ~20MB. On the second diagram I see that there is more than 20MB free but OutOfMemory occurs. Why? Garbage from switching orientation is collected.

