Search code examples
iosmemoryios-app-extension

iOS App Extension's maximum memory budget


According to Apple's App Extension Programming Guide:

Memory limits for running app extensions are significantly lower than the memory limits imposed on a foreground app. On both platforms, the system may aggressively terminate extensions because users want to return to their main goal in the host app. Some extensions may have lower memory limits than others: For example, widgets must be especially efficient because users are likely to have several widgets open at the same time.

App Extension has a very strict memory Constraint, and vary from each other.

What's the maximum memory budget for each type of App Extension?
Can I test them like iOS App ios app maximum memory budget?


Solution

  • I just encounter on iPad Pro 9.7 a crash with message:

    Thread 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=120 MB, unused=0x0)
    

    So it is 120 MB on a 2GB iOS device, but note that, limit differs based on type of extension.

    Example:

    Apple confirmed the 5-6MB memory limit for network extensions, raised to 15MB since iOS 10 Beta 2. These limits are insufficient for some Apps (see Psiphon3 ticket).

    Testing a VPN (Network Extension's NEPacketTunnelProvider) produced below error:

    Thread 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=15 MB, unused=0x0)