I am new to objective-c and I ve downloaded the code from here.
Ran Chapter 10, 10.01 CarPartsInit
xcode project file.
我不清楚的是,对一套方法的记忆管理是否如此。
- (void) setEngine: (Engine *) newEngine
{
[newEngine retain]
[engine release];
engine = newEngine;
}
应在项目结束时将发动机编号retainCount
成0。
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?