The basic rule that I have been going by is "if I alloc, I dealloc," but is this an overly simple view?
The rule is "if you invoke a method that starts with new or alloc, is called retain, or contains copy, then you must (auto)release". (Easy way to remember this is the acronym: "NARC")
If you declare a @property as (retain) or (copy), then you are responsible for the backed object, and you must do:
[myProperty release];
in your dealloc method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With