plist vs static array
Posted
by morticae
on Stack Overflow
See other posts from Stack Overflow
or by morticae
Published on 2010-05-13T23:06:58Z
Indexed on
2010/05/13
23:14 UTC
Read the original article
Hit count: 328
Generally, I use static arrays and dictionaries for containing lookup tables in my classes. However, with the number of classes creeping quickly into the hundreds, I'm hesitant to continue using this pattern. Even if these static collections are initialized lazily, I've essentially got a bounded memory leak going on as someone uses my app.
Most of these are arrays of strings so I can convert strings into NSInteger constants that can be used with switch statements, etc.
I could just recreate the array/dictionary on every call, but many of these functions are used heavily and/or in tight loops.
So I'm trying to come up with a pattern that is both performant and not persistent.
If I store the information in a plist, does the iphoneOS do anything intelligent about caching those when loaded?
Do you have another method that might be related?
© Stack Overflow or respective owner