# java.lang.OutOfMemoryError: Failed to allocate a 33177616 byte allocation with 16777216 free bytes

**Code:** `OutOfMemoryError: Failed to allocate a bitmap allocation` · **Category:** Android · **Seen on:** Android

Loading a large image consumed more memory than the app may use.

## 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

1. Use Coil/Glide with size hints
2. Downsample with BitmapFactory.Options
3. Recycle or release references

## Detailed fix by platform

### Kotlin

1. `imageView.load(uri) { size(1080, 1080) }  // Coil`

## How to diagnose

1. **Size** — decoded size?
2. **Library** — image loader?
3. **Leak** — heap dump?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/android/outofmemoryerror-bitmap)
