I have an app which sometimes receives: applicationDidReceiveMemoryWarning:.
Is there some rule, how much Ram use is ok? Like: not more than x KB, or: not more than y % of total Ram? Is there a way for the app to find out how much memory it is currently using? Is there a way for the app to find out how much memory e.g. an array of strings is using? (NSString might store the data in several formats: Utf-8, Utf-16 or whatever) + there might be some (hopefully small) overhead in both NSString and NSArray. When I have a file of 100 KB and do: myData = [NSData dataWithContentsOfFile:options:error: ]; myBytes = myData.bytes; how much Ram am I now using? 100 KB or 200 KB? I.e. does "bytes" just return a pointer to some internal structure in NSData? Would options = NSDataReadingMappedIfSafe be of some help? Currently I am using (in a singleton class): @property (nonatomic, strong) NSData *myData; - (NSData *)myData { static dispatch_once_t justOnce; dispatch_once( & justOnce, ^{ _myData = [NSData dataWithContentsOfFile:options:error: ]; } ); return _myData; } because several threads might need myData. If I would (upon receiving a memory warning) release myData, I would never be able to get it back, would I? How could I handle this case? Gerriet. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com