Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-06-2010, 12:41 AM   #1 (permalink)
Registered Member
 
AppStoreMod's Avatar
 
Join Date: Jul 2009
Location: Sacramento,CA
Posts: 90
Send a message via Skype™ to AppStoreMod
Default Don't Make NSArray's Too Long?

What does people mean when they say don't make your NSArray's so long? Just wondering because I thought it was unlimited. Just say maybe I was using it for a UITableView.
__________________
- AppStoreMod
Youtube | Website | Twitter | Xcode Video Tutorials | AppStoreApps
AppStoreMod is offline   Reply With Quote
Old 02-06-2010, 01:05 AM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
Default

Do you have an example of someone saying that? I can't imagine what they were thinking. Yes, you can store as much as you'd like until you run out of memory.

If you are *searching* a large amount of data then querying a database would be faster and more efficient than loading all of the data at once and looping through it; maybe that's what they meant?
__________________

Free Games!

Last edited by smasher; 02-06-2010 at 01:08 AM.
smasher is offline   Reply With Quote
Old 02-06-2010, 01:09 AM   #3 (permalink)
Registered Member
 
AppStoreMod's Avatar
 
Join Date: Jul 2009
Location: Sacramento,CA
Posts: 90
Send a message via Skype™ to AppStoreMod
Default

Quote:
Originally Posted by smasher View Post
Do you have an example of someone saying that? I can't imagine what they were thinking. Yes, you can store as much as you'd like until you run out of memory.

If you are *searching* a large amount of data then querying a database would be faster and more efficient than loading all of the data at once and looping through it; maybe that's what they meant?
What they say is

"If you keep adding objects on the main thread" then it will be all messed up.
__________________
- AppStoreMod
Youtube | Website | Twitter | Xcode Video Tutorials | AppStoreApps
AppStoreMod is offline   Reply With Quote
Old 02-06-2010, 01:37 AM   #4 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
Default

Quote:
Originally Posted by AppStoreMod View Post
What they say is

"If you keep adding objects on the main thread" then it will be all messed up.
Were they talking about multi-threaded development? If so, it's true that NSMutableArray is not thread safe, so you better (1) lock it before adding/removing, and while getting an object from an index. (2) retain objects that you get from the array/dict in case another thread removes them from the array. Apple has a tech note with more info.
Technical Note TN2059: Using collection classes safely with multithreaded applications

However, if you are not launching your own separate threads then there is nothing to worry about.
__________________

Free Games!
smasher is offline   Reply With Quote
Old 03-02-2010, 03:24 PM   #5 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 24
Default Advice

Hi all !! I have search a lot on the net and i am wondering :

- In a tab bar based app i'm creating an array from severals plist files, i create tempArray, i fill the array with my tempArray, and release the temp.
At the end my fullArray has 1101 objects, only string.

Is it too long, will it be a problem for iPhone memory ? Or maybe Apple does not like this way of using amount of data when i ll take my app to iTunes connect.

Thanks to all
MonsterMunch03 is offline   Reply With Quote
Old 03-02-2010, 05:22 PM   #6 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
Default

Quote:
Originally Posted by MonsterMunch03 View Post
- In a tab bar based app i'm creating an array from severals plist files, i create tempArray, i fill the array with my tempArray, and release the temp.
At the end my fullArray has 1101 objects, only string.

Is it too long, will it be a problem for iPhone memory ? Or maybe Apple does not like this way of using amount of data when i ll take my app to iTunes connect.
I can't answer- you need to test on the phone to see how much memory it uses, and how fast it is. If it is too slow you'll have to switch to using core data (or SQLite) and ONLY loading the records you need, instead of loading all records at once.
__________________

Free Games!
smasher is offline   Reply With Quote
Reply

Bookmarks

Tags
long, nsarray, short, size, uitableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 264
16 members and 248 guests
@sandris, ADY, Alsahir, dacapo, Dani77, Desert Diva, djohnson, HemiMG, jansan, JasonR, MarkC, prchn4christ, ryandb2, smethorst, tomtom100
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:58 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0