Do not think about memory management from the point of view of abstracts pools or keep an account. Think about it in terms of whether you own the property or not. If you own it, you are responsible for his release.
Both of these lines create stored properties:
@property (nonatomic, copy) NSString *text; @property (nonatomic, retain) NSString *otherText;
Copy simply means saving a copy, not the original. Both of these properties are memory managed, so you donโt have to worry about saving or releasing under normal use.
self.text = string1; // this retains a copy of string1 self.text = string2 // this releases the copy of string1 and retains the copy of string2 self.text = nil; // this releases the copy of string2
You have self.text and self.otherText, so you need to free them in dealloc.
If you do not select, not new, copy or save the object, you do not own it. If you do not own it, but you need to guarantee that it will adhere to the end of the launch cycle, claim ownership, retaining it.
source share