iOS memory pressure

3998
2
Jump to solution
11-04-2014 08:10 AM
DavidGreene
New Contributor III

We have been working on a native iOS app for quite a while and have become frustrated trying to track down the causes of memory pressure warnings.  We are not able to replicate the issue in a consistent manner to effectively trace/snapshot the application.  One of our clients was using the app for a couple of weeks, creating over 200 detailed inspections with attachments.  Then suddenly they are getting memory purge warnings every 2-5 inspections.

This is the only application running on the device .. all other applications have been terminated.  The memory warnings persist even after the application is uninstalled and reinstalled .. which should have removed any data associated with the app.  When the memory warnings occur, some devices have 750MB (out of 1GB) of system memory available, others only have 50-200MB.  We can understand the warnings when there is only 50MB free, but 750MB?

We can log in as this user on a device with identical specs and view the same data and perform identical workflows with no issues.  We are fairly certain that it's not related to the amount of data or the specific workflow.  We are not forcibly caching anything in memory or using large collections.  What we can't identify is if there is anything the Runtime SDK is doing behind the scenes that may be caching data or storing some other information that is loaded into memory.

The application specs are:

  • Runtime SDK 10.2.4 against ArcGIS Server 10.2.2
  • 4 AGSFeatureLayers, 1 AGSLocalTiledLayer, 1 AGSDynamicMapServiceLayer, 1 AGSTiledLayer
  • search for features using AGSQueryTask
  • AGSGDBFeatureTable and sqlite geodatabase with about 30000 point features
  • synchs data to AGSFeatureLayer using applyEditsWithFeaturesToAdd and AGSAttachmentManager
  • iOS 7.1.2 and iOS 8+
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

David,

Have you tried Instruments in Xcode?

The best way I found to track memory issues is to use the Instruments that come with Xcode, you can add the memory module and run the application, will give you the top methods using more memory. Also, you want to then use the memory leak module in instruments to see if you have a memory leak on the application that is causing the warning.

Hope this helps

Cheers

Al

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable

David,

Have you tried Instruments in Xcode?

The best way I found to track memory issues is to use the Instruments that come with Xcode, you can add the memory module and run the application, will give you the top methods using more memory. Also, you want to then use the memory leak module in instruments to see if you have a memory leak on the application that is causing the warning.

Hope this helps

Cheers

Al

0 Kudos
DavidGreene
New Contributor III

Al,

I wasn't directly involved in the development, but I took it upon myself to run the app through the instrumentation.  No leaks were reported by the Leak module.  However, running through the Allocations module showed that out of the 250+MB application footprint, more than 150MB was consumed by persistent UILabels.  It turns out that the UIPicker we were using was maintaining strong references to the labels as they were scrolled into view and for each instance of the view that was shown.  Since we were using this to allow the user to pick from coded domain values, this racked up pretty quickly when creating or modifying attribute information.

We changed some of the code around the picker and have removed that specific cause of memory pressure warnings.  So far, no more issues have been reported.

Thanks!