开发者

iOS: General tips on managing memory for large data sets on iPhone?

开发者 https://www.devze.com 2023-03-07 14:56 出处:网络
I\'m currently working on an iPhone app that is fairly data intensive. It downloads about 300kb of XML data, holds this entirely in memory in arrays and dictionaries of model objects and开发者_运维问答

I'm currently working on an iPhone app that is fairly data intensive. It downloads about 300kb of XML data, holds this entirely in memory in arrays and dictionaries of model objects and开发者_运维问答 performs various operations on this data that likely cause it to grow a few times in size.

How do you go about managing data sets of this sort of size? Would you use core data to manage this, or would you simply hold this data in memory as I have done and manipulate it that way? There is never a need for me to actually persist any of this data on the device.

Additionally, should I be concerned about holding this amount of data in memory?

Just looking for some general advice here and wondering what others have done in similar situations. Thanks for the tips.


Instead of keeping the 300 kB of data in memory, consider putting the XML data into a Core Data store.

Faulting is used with Core Data predicates ("searches") to "lazy-load" information — i.e., you're only pulling data from the store when you need it, which reduces memory and performance overhead.

I suspect that pre-fetching some of your more frequently re-used data can help your app with performance. Read the Core Data Performance docs for more info.

0

精彩评论

暂无评论...
验证码 换一张
取 消