I am new to objective-c and I've downloaded the code from here.
Ran Chapter 10, 10.01 CarPartsInit
xcode project file.
One thing I am not clear about is that, does the memory management of a setter method
- (void) setEngine: (Engine *) newEngine
{
[newEngine retain]
[engine release];
engine = newEngine;
}
supposed to result with the engine retainCount
to be 0 at the end of the program.
I ran some NSLog
and when the program ends... the retainCount
for engine was at 1...
Should it go to 0 and be freed? Or is this a memory leak?