In an implementation of dealloc, you should not invoke the
superclass’s implementation. You override this method to dispose of
resources other than the object’s instance variables, for example:
- (void)dealloc
{
free(myBigBlockOfMemory);
}
Above says we should not invoke the superclass’s implementation. But below it says we should “incorporate superclass versions of dealloc through a message to super.” So there seems to be some conflict between the two paragraphs. It must be due to something that I’ve missed. Hope somebody can explain this …
If you are using manual reference counting, subclasses must implement
their own versions of dealloc to allow the release of any additional
memory consumed by the object—such as dynamically allocated storage
for data or object instance variables owned by the deallocated object.
After performing the class-specific deallocation, the subclass method
should incorporate superclass versions of dealloc through a message to
super:
- (void)dealloc {
[companion release];
free(myBigBlockOfMemory);
[super dealloc]; }
Your first quote is for when automatic reference counting (ARC) is enabled, and your second quote is for when ARC is not enabled. ARC is a new feature provided in SDK 5.0 that eliminates much of the manual memory management that needed to be done by the programmer.
See Transitioning to ARC Release Notes, in particular these statements: