Grindr Jul 4, 2019

Handling WebP OutOfMemoryError in Android

Article Summary

Ansgar Lin from Grindr Engineering discovered their app was crashing with OutOfMemoryErrors, and the culprit wasn't bad code. It was a tiny WebP image causing massive runtime memory allocation.

WebP images are popular for reducing APK size and bandwidth, but they hide a dangerous trap. A small WebP file can balloon into a huge bitmap at runtime if created from an oversized source image. Lin breaks down a real production crash and the math behind why it happened.

Key Takeaways

Critical Insight

Always resize images to their exact display dimensions before converting to WebP, or risk OOM crashes from hidden memory bloat.

The crash distribution chart reveals why newer Android versions handle this problem dramatically better than older ones.

Recent from Grindr

Related Articles