I am importing a bunch of data from a web service on a background thread and I randomly run into bad access problems, I believe mostly from assigning relationships.
I am wondering how long the new entities I create and save hang around?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Core Data follows the same rules as any other object in Objective-C except with a slight twist.
Core Data will decide internally when to release the objects, so even if you are done with an object and you have released all of your references to it, it may stay around after that depending on what Core Data decides to do with it.
In addition, when a
NSManagedObjectis loaded into memory the entire object may not necessarily be loaded. Core Data, by default, will load the basic structure of the object but will not load in its data or relationships. This keeps the initial memory footprint very low. When you access a property then the entire instance will be fully realized.The short answer is this: As long as you follow the retain release rules you do not need to worry about memory management with Core Data.