java.lang.OutOfMemoryError: Failed to allocate a 33177616 byte allocation with 16777216 free bytes
Loading a large image consumed more memory than the app may use.
OutOfMemoryError Failed to allocate a byte allocationOutOfMemoryError bitmapFailed to allocate a with free bytesjava.lang.OutOfMemoryError: Failed to allocate a 33177616 byte allocation with 16777216 free bytes and 28MB until OOM, target footprint 134217728, growth limit 134217728 Meaning
Decoding full-resolution photos into Bitmaps is the usual cause. Downsample with inSampleSize, use Coil/Glide/Picasso, and avoid keeping many large bitmaps in memory.
Common causes
- Full-size bitmaps decoded for thumbnails
- Bitmaps leaked in static fields
- Large images in drawable-nodpi
⚡ Quick fix
- Use Coil/Glide with size hints
- Downsample with BitmapFactory.Options
- Recycle or release references
Detailed fix by platform
Kotlin
imageView.load(uri) { size(1080, 1080) } // Coil
How to diagnose
- Size — decoded size?
- Library — image loader?
- Leak — heap dump?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Android
- Could not resolve Gradle: Could not resolve all files for configuration / Could not resolve dependency
- INSTALL_FAILED_USER_RESTRICTED INSTALL_FAILED_USER_RESTRICTED: Install canceled by user (Xiaomi/MIUI, Oppo, Vivo)
- INSTALL_PARSE_FAILED_NO_CERTIFICATES INSTALL_PARSE_FAILED_NO_CERTIFICATES / App not installed as package appears to be invalid
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 25 Nov 2026