So I'm looking through a log of an OOM failure where I see the following:
05-15 14:18:15.801: D/dalvikvm(5425): GC_BEFORE_OOM freed 12K, 63% free 18896K/49863K, paused 43ms, total 44ms
05-15 14:18:15.801: E/dalvikvm-heap(5425): Out of memory on a 25694224-byte allocation.
05-15 14:18:15.801: I/dalvikvm(5425): "AsyncTask #4" prio=5 tid=35 RUNNABLE
05-15 14:18:15.801: I/dalvikvm(5425): | group="main" sCount=0 dsCount=0 obj=0x41f117e8 self=0x5db0f2c0
05-15 14:18:15.801: I/dalvikvm(5425): | sysTid=5539 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1544307456
05-15 14:18:15.801: I/dalvikvm(5425): | schedstat=( 0 0 0 ) utm=19 stm=2 core=0
05-15 14:18:15.801: I/dalvikvm(5425): at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
05-15 14:18:15.801: I/dalvikvm(5425): at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:520)
This looks weird to me. Why is there an OOM on ~25mb allocation when I have ~30mb available?
EDIT
The code goes roughly through these steps:
- camera.takePicture(null,null,callback)
- inside callback send data to AsyncTask for processing/saving
- AsyncTask decodes byte array into a Bitmap for further rotation
- bOOM!