Can you describe the naming convention difference between a method that returns an object it has allocated for the caller (and that the caller should release), and a method that returns an autorelease object?
If you declare a property with a retain attribute, do you need to release the property before you set it to nil?
What does the @synthesize directive do?
A good source for memory allocation is listed below by Aaron.
Regarding
@synthesize:Say you have a property
P, what you will have to do is write a getter and a setter for it. There are a few common approaches, one of which is that you retain that object when you set that property and release the old value. E.g:Since this is a very common piece of code, the compiler can automate it for you, if you specify the
retainkeyword in property declaration and then do the@synthesizein you implementation. The compiler will generate the above mentioned code which means your code will be a lot cleaner without tedious repeating parts.Same holds true for getters, unless you want something more complex than:
the
@synthesizewill do the job