How many files can we safely keep open in an iOS application?
We are using FMOD to play audio in our game and apparently there a good strategy is to keep audio files pre-opened, but not loaded to memory, for rapid playback upon need.
I did not find information about either per-process limits not global system wide limits in Apple's documentation, here on SO, or anywhere else.
This quick test using a handy Python env on iPad suggests that the per-process limit is 250:
I think we stay below that limit. But we suspect that there is a rare problem situation where opening files fails.
Is there also a system wide limit that can affect at some point?
The per-app limit that I think I discovered with that test was asked in a comment in a related question but I can not comment there due to not having any reputation (first post): on iOS/iPhone: "Too many open files": need to list open files (like lsof)
EDIT:
The limits are easy to check on OSX like this. Perhaps possible also on a jailbroken iOS device, or somehow from an app using Apple's API / launching that system command?
Tonis-MacBook-Pro:MacOS antont$ sysctl kern.maxfilesperproc
kern.maxfilesperproc: 10240
Tonis-MacBook-Pro:MacOS antont$ sysctl kern.maxfiles
kern.maxfiles: 12288