Splunk MINT SDK for iOS (Legacy)

Splunk MINT SDK for iOS Developer Guide

Acrobat logo Download manual as PDF


Splunk MINT is no longer available for purchase as of January 29, 2021. Customers who have already been paying to ingest and process MINT data in Splunk Enterprise will continue to receive support until December 31, 2021, which is End of Life for all MINT products: App, Web Service (Management Console), SDK and Add-On.
Acrobat logo Download topic as PDF

View memory warnings

A memory warning is a signal that is sent to your app when it leaks. If the app terminates because of a memory leak, the app won't generate a crash report. Because of that, you might not be able to find and fix the leak in your production app unless you already implemented the memory warning delegate to free up memory in the ViewController class.

To help you manage memory, the Splunk MINT SDK for iOS has a memory warning feature that collects the memory footprint and the class that received the memory warning. When an app terminates but doesn't send a crash report, that means the app received a memory warning and sent the memory footprint to Splunk Enterprise. So, go check your MINT data in Splunk Enterprise for recent memory warnings, which might help you fix memory issues in your mobile apps.

To work with memory warnings for MINT, initialize the Splunk MINT SDK for iOS with your API key, preferably in the beginning of your application delegates. For example:

- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[Mint sharedInstance] initAndStartSessionWithAPIKey:@"API_KEY"];
    // ...
   return true;
}

The initAndStartSessionWithAPIKey method enables the memory warning monitor by swizzling the interceptor method with the didReceiveMemoryWarning delegate method of the UIViewController class. So when the OS sends a memory warning signal to the ViewController class, the warning gets logged by the MINT interceptor. The logged data is serialized into JSON data and tagged with the sourcetype "memorywarning", then sent to Splunk Enterprise.

The memory information contains the following fields:

  • className
  • totalMemory
  • usedMemory
  • wiredMemory
  • activeMemory
  • inactiveMemory
  • freeMemory
  • purgableMemory


To view this information, run a search in Splunk Web for the "mint:memorywarning" sourcetype, for example:

index=mint sourcetype="mint:memorywarning" | head 5

Here's an example result:

 {
   activeMemory: 9118
   apiKey: 12345
   appEnvironment: Testing
   appRunningState: Foreground
   appVersionCode: 1
   appVersionName: 1.0
   batteryLevel: -100
   carrier: NA
   className: UINavigationController
   connection: WIFI
   currentView: GHUnitIOSViewController
   device: x86_64
   extraData: {
   }
   freeMemory: 3040
   inactiveMemory: 1511
   locale: US
   message: Received memory warning
   msFromStart: 4334
   osVersion: 9.3
   packageName: SplunkTests
   platform: iOS
   purgableMemory: 210
   remoteIP: 204.107.141.240
   screenOrientation: Portrait
   sdkVersion: 5.0.0
   session_id: 1C048628-A709-44BC-9110-25069C7FC736
   state: CONNECTED
   totalMemory: 16384
   transactions: { [+]
   }
   usedMemory: 454
   userIdentifier: NA
   uuid: fake_uid
   wiredMemory: 2112
} 

To monitor memory warnings as they happen, you could create a real-time alert as follows:

  1. In Splunk Web, run this search:

    index=mint sourcetype="mint:memorywarning"

  2. Select Save As > Alert.
  3. For Alert Type, click Real-time.
  4. Click Add Actions to select an alert action.
  5. Click Save.
Last modified on 05 November, 2019
PREVIOUS
Report user-specific data
  NEXT
Trace Objective-C methods

This documentation applies to the following versions of Splunk MINT SDK for iOS (Legacy): 5.2.x


Was this documentation topic helpful?


You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters