Are Your OOM Issues Device-Related?

One reason that developing software for mobile devices can be so much more challenging than developing for desktops/laptops or other hardware, according to ThoughtBot’s Steff Kelsey, is that resources are limited. One particularly sparse resource is RAM. Because of this, Out-of-Memory exception errors (OOMs) are common on iOS, especially if you’re dealing with large files in your app.

Because they are so common and important to overcome, we’ve mentioned Out-of-Memory exceptions and their causes before. There are many factors can cause apps to terminate early in this way, including in-app aspects like CPU pegging, app memory usage, and broken screens. Out-of-app elements like the device’s OS, hardware, or memory being devoured by other apps can also play a role in app termination. What’s more, the complexity of how these multiple factors relate to one another causing an OOM can make the problem a difficult one to solve.

Does the Device You’re Developing for Increase the Chances for OOM Errors?

If we revisit the first paragraph of this story, we can see that a primary issue related to OOMs is RAM usage and it’s limitations on mobile devices. At the risk of stating the obvious, larger devices have larger screens requiring higher resolution images for viewing, thus taking up more memory. This extra imagery baggage can cause memory leaks and inevitable RAM-draining exceptions.

Out of memory exception on a mobile phone.

What Can Be Done to Eliminate OOM Errors on Larger Devices?

Broadly speaking, reducing an app’s total memory usage is a crucial first step to minimizing OOMs. Therefore, when you are developing for larger format mobile devices, you may have to be a bit more thorough in making sure coding approaches are efficient. This extra attention will ensure loops or calls that might be benign with smaller images won’t go rogue when referencing images with more heft. Other common causes of OOM errors—and solutions for preventing them—include:

There are always other scenarios, but these are a few common solutions.

Will This Be Enough?

One thing that can be troubling is that many of these problems only become visible after your app has been released into production. As developers, we try to deploy on a number of test devices, but even the best QA approaches can be limited in the number of devices tested. Ultimately, an app can get to end user devices that may not have been profiled. Experienced development processes and code reviews can prevent these issues, but additional tools are always helpful.

Insights and device profiling assistance from a tool like Embrace.io can help get ahead of potential bottlenecks and lessen the need for pushing out short turnaround technical hotfixes.

Find the lowest-hanging fruit for improving app performance; request a demo today!




If you found a few bits of value, please share:
Three Benefits of Speed and Reliability For Your Mobile App
Debugging Checklist: Top 3 Things That Hurt Your App