IOS virtual memory: iOS automatically exits const const arrays when memory is low?

If you have a gigantic static const array (say, several tens of megabytes) that never changes and is used only at startup, is it automatically unloaded when there is not enough memory? That is, iOS knows that your static const data can just be reloaded from your application package?

The obvious alternative is to put this data in a file and either a memory card, either as data in readonly mode (which, of course, was automatically unloaded), or read it in the malloc'd buffer and free it when it is done, but it more work than necessary in this case?

+4
source share
1 answer

The implementation of iOS memory management is not documented and may be changed when updating the OS. I will not depend on undocumented behavior for anything important. Is there a reason why you could not store your data in SQLite (I'm a fan of YAPDatabase , but any database will work) and request it as needed? This will reduce the use of your memory and make the application more enjoyable.

+1
source

All Articles