memoryHandling Memory Warnings

Forward iOS memory warnings to ContextSDK so it can release non-critical caches.

iOS sends a memory warning to your app when the system is running low on memory and may terminate apps that don't reclaim enough quickly. ContextSDK exposes a method you can call from your existing memory-warning handler so it can release any optional in-memory data it doesn't need to keep around.

Calling this method has no effect on the SDK's correctness - anything released can be re-derived on demand, and recent contexts created via your own flow names are still available afterwards.

Forwarding the memory warning

Call ContextManager.didReceiveMemoryWarning() from your UIApplicationDelegate.applicationDidReceiveMemoryWarning(_:):

func applicationDidReceiveMemoryWarning(_ application: UIApplication) {
    ContextManager.didReceiveMemoryWarning()
}

The method is safe to call at any time after applicationDidFinishLaunchingWithOptions(_:licenseKey:), and from any thread.

Last updated

Was this helpful?