iphone - CFString objects being declared by [NSBundle mainBundle] -



iphone - CFString objects being declared by [NSBundle mainBundle] -

i working on performance improvement of ios cocos2d game. checking memory allocations of app help of instruments tool when noticed 1 thing. there many cfstring objects beingness declared , held [nsbundle mainbundle] call. says,

category: cfstring (immutable) responsible caller: [nsbundle mainbundle]

there many places in code wrote next lines

[[nsbundle mainbundle] pathforresource:@"resource-name" oftype:@"png" isdirectory:imagedirectory];

is cfstring problem because of above code because giving hard coded string in pathforresource method? or can reason of issue? can please help? cfstring allocations taking 2mb of code worried it.

best regards

these cfstring's due having big number of resources in application bundle. in testing found 1 cfstring allocated each file @ root of bundle. presumably kind of caching of path names.

i working on app 1,000's of resources in bundle , these immutable strings taking ~ 300k. when remove bulk of them, wind 20k, around 100 cfstrings ~ 80 resources in bundle.

it seems reply reducing these set resources in sub-directories within bundle. can utilize "folder reference" in xcode this.

for example, might have 1,000 pngs game. set in folder called "assets" in project (on disk). drag "assets" directory xcode , instead of creating group, create folder reference.

iphone objective-c nsbundle cfstring mainbundle

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -