top of page
Writer's pictureDon Peter

How to detect abnormal memory usage and memory spikes in iOS apps

Updated: Sep 24, 2022

Though it is often advised to keep the app’s memory footprint as low as possible, developers tend to overlook this aspect during app development. As a result, the elements that consume the app’s memory go unchecked, which leads to the app consuming an abnormal amount of the device’s memory.


When the iOS app consumes a considerable amount of allocated memory, it leads to an out of memory exception, resulting in an app crash and affecting user experience. This makes it important for developers to be notified about abnormal memory usages in both development and production environments at the earliest.  


Abnormal memory usage occurs when unused memory is not reclaimed properly or because of inefficient object reuse.


With Finotes, abnormal memory usage can be detected at the earliest and developers get to fix the issue fast.

Finotes is an automated bug reporting tool that is capable of detecting abnormal memory usages and memory spikes in iOS apps.


Using Finotes to track memory issues in iOS


With a simple 3-step integration process, Finotes framework for iOS detects and reports abnormal memory usage in both development and production environments. Please visit our documentation page for more details. 


Tracking memory usage with Activity trail


Finotes reports high memory usage when the iOS app consumes more than 30% of the physical memory. The bug report will have data points like activity trail with memory usage patterns along with device and device state information, which will aid developers to reproduce the bug. 

Screenshot of an activity trail from an issue report in Finotes dashboard

Activity trail consists of a list of events that occurred one minute prior to the issue occurrence. The app events along with the percentage of free memory available at each point are displayed in a chronological order. 



Components of Activity trail



Screenshot of a section of activity trail from an issue report in Finotes dashboard

Activity

The activity segment has details of the app events. The user event will have two components separated by a colon

  •  The name of the class in which the event gets reported

  •  The textual description of the event.


Timestamp

The timestamp segment has details related to the time at which the event gets recorded. 


Free Memory

The memory segment also contains the percentage of free memory available for the app at the time of the event. 



How Finotes helps in finding the root cause

Screenshot of abnormal memory usage along with activity trail reported in Finotes dashboard

Let’s consider a use case as indicated in the above screenshot. Here, Finotes has detected high memory usage in an iOS app. The issue is that the app’s memory usage crossed 2587213824 bytes, which is more than 30% of the physical memory size i.e 8589934592 bytes. 


With an in-depth evaluation of the activity trail section in the issue report, we understand that while loading the first banner image, the free memory was around 79%. But when the final banner image was loaded, the memory dipped down to almost 71%. So with each banner image, the amount of free memory available goes down. By analysing the issue further in code, we can come to the conclusion that the root cause for the free memory dip was that the allocated objects for banner images are not released. 


This scenario may lead to an app crash. In order to avoid the app from crashing, Finotes detects and reports whenever the app consumes more than an ideal amount of free memory.


Activity trail helps developers to pinpoint where exactly the issue is so that necessary changes can be made in the code and a patch version be released fast. 

Custom Activity Trail events


Apart from default events, Finotes allows developers to set custom app events in activity trail (refer our Objective-C and Swift documentation) with an API, which can be called anywhere in the code. These custom events will be recorded and shown along with default app events in the activity trail section in Finotes dashboard. 


Along with high memory usage and spikes, Finotes also detects memory leak in iOS apps. To know more read our blog Detect memory leaks in iOS


Apart from memory-related issues, Finotes capable of detecting and reporting crashes, API call issues, frame rate issues, ANR, function failures, exceptions, delays and custom issues.  

Finotes is available for iOS as Objective-C and Swift Frameworks, watchOS as Objective-C and Swift Frameworks, and Android as Java and Kotlin SDKs platforms. 


Visit finotes.com to know more about Finotes. Detailed documentation is available at docs.finotes.com



Comments


Blog for Mobile App Developers, Testers and App Owners

 

This blog is from Finotes Team. Finotes is a lightweight mobile APM and bug detection tool for iOS and Android apps.

In this blog we talk about iOS and Android app development technologies, languages and frameworks like Java, Kotlin, Swift, Objective-C, Dart and Flutter that are used to build mobile apps. Read articles from Finotes team about good programming and software engineering practices, testing and QA practices, performance issues and bugs, concepts and techniques. 

Monitor & Improve Performance of your Mobile App

 

Detect memory leaks, abnormal memory usages, crashes, API / Network call issues, frame rate issues, ANR, App Hangs, Exceptions and Errors, and much more.

Explore Finotes

bottom of page