Apple is doing this in a setter method for an instance variable mainSprocket:
– (void)setMainSprocket:(Sprocket *)newSprocket {
[mainSprocket autorelease];
mainSprocket = [newSprocket retain];
return;
}
Why do they send -autorelease and not -release? Would a -release have a bad effect here? Actually it should not (for my understanding), because the -release just says that the current object held by the instance variable mainSprocket is no longer used by that instance variable. For the case that anyone else is still interested in exactly that object, that method could retain it, right? So -release should be fine, I think?