Shortcuts action crashing with exceeded memory limit

I've added Shortcuts support to my app but some users are reporting the Shortcuts app is losing communication with it. I was able to replicate and debug the issue. My app is crashing when trying to load 30MB.

My action receives an image as input, resizes it and then uses it to perform an object detection operation. The crashes always happen before reaching the detection (like when I am resizing the image or when I am instantiating the CoreML model).

Any ideas on how to troubleshoot this? I would like to know better about Shortcuts memory limits.

Replies

SiriKit Intents Extensions have a 30MB memory limit. Consider trying ways to reduce memory usage in your extension, if possible.

If your operation (loading large images, or doing lots of processing) requires more than 30MB, you might want to consider switching to in-app intent handling, which is a new feature in iOS 14. When using in-app intent handling, you can use much more resources while handling an intent.

To learn how to implement this, watch the Empower your intents video from WWDC 2020.