简体   繁体   中英

Help with loading large amount of data

I have an array with 500 objects, I have been told that this is not a smart idea because of the huge amount of memory it takes. I was told that Core Data SQLite would be good for me to load just one of these objects instead of all of them at once. Here's my situation though, I'm not sure if core data would work here

My array basically chooses a random Nib file to load, the program chooses a random index object, and then goes off of that go load the corresponding Nib file.

Would I be able to do this with core data? It seems like having all objects loaded into the array all at once is the only way to get this to work. Does anyone know If core data could do something like this?

I'm very new to core data, and seem to be very confused about it. Also if someone could point me to a well know tutorial of it, that would be nice too :)

Thanks, Jacob

500 objects is not much. Even a pretty complex object like UITableView has an instance size of 648bytes, this size changes by OS version but you get the idea. Even your quite modest class would not get over 1000 bytes. Leaving you at less than half a megabyte of ram.

On top of that you have to add the space for objects in your ivars. But I doubt that a puny 500 objects is a problem.

Have you checked the logs to see if you get any memory warning notifications?

Have you run the app with Instruments to measure the real memory impact you have?

Do all these before you begin implementing a solution to a problem you might not have.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM