The crash our error tracker never saw: out-of-memory kills on low-RAM Android
Our React Native app crashed in 4.2% of sessions. Almost all of those sessions were on Android phones with 3 GB of RAM or less, and our error tracker showed almost nothing. This is the story of a crash that produces no stack trace, how we found it anyway, and what fixed it.
The first clue was silence
When an app crashes this often, you expect the error tracker to be on fire. Ours was calm. Sentry listed a handful of unrelated JavaScript errors, nothing that came close to explaining four crashes in every hundred sessions.
That gap was the clue. An error tracker reports what the app can tell it: a JavaScript exception, a rejected promise, a native signal that a crash handler can catch. An out-of-memory kill is none of those. When Android runs short of memory, the low memory killer ends the process from the outside. No handler runs, no report is written, and the next launch looks like a normal cold start.
Where the signal actually was
The operating system does keep score. Android vitals in the Play Console records how sessions end, whatever the app itself managed to report. The overall number was bad but not obviously alarming. Splitting it by device class changed the picture: phones with plenty of memory were fine, and nearly every abnormal exit came from devices with 3 GB of RAM or less.
That pattern rules out most logic bugs. A null pointer does not care how much memory the phone has. A crash that follows RAM size is a memory problem until proven otherwise.
The cause was boring: images
A photo's file size says very little about what it costs to show. Once decoded, a bitmap takes four bytes for every pixel, no matter how well the JPEG was compressed. A 12-megapixel photo therefore needs roughly 48 MB of memory.
Our feed rendered about a dozen of those photos at 90 px wide. The app was holding more than half a gigabyte of pixels that nobody could see, on phones where the whole process is allowed a fraction of that.
The same arithmetic shows why the fix had to happen before the image reaches the phone. Cropping with styles changes what the user sees. It does not change what the decoder allocates.
What we changed
None of the four changes is exotic. Together they remove the pressure instead of hiding it.
| Change | What it removes |
|---|---|
| Resize images on the CDN to display size | Full-resolution bitmaps never reach the device |
| A native image component with caching and downsampling | Repeated decodes, and oversized bitmaps when a source cannot be resized |
| Capped list render windows, subscriptions cleaned up on unmount | Off-screen rows and dead listeners that keep memory alive |
| Only the fields each screen needs in the global store | Whole API payloads held in memory for the life of the session |
The first change does most of the work. The other three matter because memory problems rarely have a single source: once the images were under control, list windows and an overfed store were the next largest holders of memory, and on a 3 GB phone there is not much headroom to give away.
The result
Crash-free sessions went from 95.8% to 99.4%, and peak memory dropped by about 40%. The app also felt faster on the cheapest phones, which is where most of the complaints had come from in the first place.
What to take from it
- A crash your error tracker cannot see is still a crash. Treat Android vitals and the App Store's diagnostics as a second source of truth, not a formality.
- Check stability by device class, not only by app version. An average hides the group that is having a terrible time.
- Test on the cheapest phone your users actually have. A flagship will happily carry mistakes that a budget device cannot.
- Size images for the screen, on the server. It is the cheapest memory you will ever save.
If crashes follow the amount of RAM and your error tracker is quiet, stop reading stack traces and start measuring memory.
