I’ve been confused about core data entities. Since you never allocate them do you need to retain them? When a view controller has an entity as one of its properties should it be weak when another view controller assigns the entity but strong when the view controller sets the property itself?
I’ve been confused about core data entities. Since you never allocate them do you
Share
Core Data entity is just an object like any other, so you should follow memory management rules. You
retainentities when you need them andreleasewhen you no longer need them.For example: using sqlite backend, core data will cache loaded data to minimize amount of requests sent to db. But it can’t keep all the records in memory and it should understand which entities you use and which don’t, so it can release unused and free memory. In case using
weakproperties you can end up with garbage pointer or nil instead of actual object.