Creating an object procedure
1. Allocating memory space, storing objects
2. Initializing member variables
3. Return the object's pointer address
When the object is created, a reference counter (Retaincount) is automatically created internally, which is the only basis for the system to determine whether an object needs to be recycled.
When retaincount = 0, the system automatically recycles the current object.
[Object Release] RetainCount-1
[Object retain] Retaincount +1
The Dealloc function, which is automatically called when an object is about to be destroyed, notifies the object that it will be destroyed.
Be sure to invoke [super Dealloc] to liberate related objects in the parent class before destroying the object itself.
Manual memory management Principles (pairing principle)
As long as the appearance of New,alloc,retain must appear a release,autorelease.
Xcode Manual Memory Management notes