Memory Limit for Background Assets Download Extension

Is there any memory limit for Background Assets Download Extension?

I am using a manifest file that is ~2.5MB and has ~15000 entries. I am trying to load them into an array but the process keeps getting killed, there is no error message.

If I am loading ~1000 entries, it's working fine.

Is there a way to increase the memory limit for Background Assets Extension?

In iOS 16 the extension is currently configured for 6MiBs memory usage. If the extension exceeds this threshold, the system will terminate it.

I'd advise memory mapping the file with NSData using NSDataReadingMappedAlways. Memory mapped files that are backed by storage do not count towards overall memory usage of your process, as long as the file isn't modified after opening it. This will allow you to read the file from physical storage without paying a penalty of placing the file into physical memory.

@jaredjones Thanks for replying.

I noticed one issue when the process was killed inside withExclusiveControl block. the lock was not getting released

manager.withExclusiveControl

I tried killing and reopening the app, but I was still unable to enter the withExclusiveControl block. After restarting the device it started working. Any suggestions/ workaround on how to avoid this?

Memory Limit for Background Assets Download Extension
 
 
Q