Objective C iPhone performance issue

Posted by Asad Khan on Stack Overflow See other posts from Stack Overflow or by Asad Khan
Published on 2010-04-26T09:06:34Z Indexed on 2010/04/26 9:53 UTC
Read the original article Hit count: 201

Filed under:
|
|
|

Ok guys I am developing an iPhone app I have a Model class which follows a Singleton design pattern.

Now I have an NSArray in it which is initialized to around some 1000 NSStrings in the init method.

Now I need to use this data in some view controller. so I import Model.h, I create an array of NSString objects in view controller & set the data to it. But now the problem is that now I have 2000 NSStrings currently allocated, which I believe is not a good thing on iPhone due to memory considerations.

releasing model object wont help because I've overrided release method to release nothing according to the pattern & I cannot change the design now because now a lot of code works on the assumption of model being a singleton.

& in future maybe the initial NSStrings may grow to 2000 or even more & then I'll have 4000 NSStrings allocated at one time ....

I am a little confused on how to go about it any suggestions

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c