本帖最后由 wwwwjay 于 2015-5-27 10:35 编辑
int main(int argc, const char * argv[])
{
hehe* student;
@autoreleasepool
{
student = [hehe createHehe];
[student retain];
NSLog(@"retainCount %lu", [student retainCount]);
}
NSLog(@"retainCount %zi", [student retainCount]);
return 0;
}
+ (id) createHehe
{
id p = [[[hehe alloc] init ] autoRelease];
return p;
}
这样输出结果为 2, 1
但是我将retain操作 注释了为什么是 1,1 而不是1,0?
|
|