In the cocoa database, the fruit database developer uses the library written by the following rules:
1. If the object is created using the "-" initialization method, the object only adds 1 to the reference count, that is, it executes a retain operation internally.
2. If the object uses "+" to initialize the object (equivalent to the static method of Java or C ++), the object not only adds 1 to the reference count, but also automatically performs the autorelease operation.
3. If the method of an object returns a new object, the object is autorelease.
4. If you use the attribute declared by @ property (retain), The retain operation and nil assignment will be executed during the first value assignment, and the release operation will be executed.
5. In the message loop of uiapplication, an autorelease pool is created every time. Therefore, in main thread, you do not need to create another autorelease pool.
6. The dynamic system sometimes executes retain on the user's object, soProgramDo not observe retaincount by yourself.
7. The dalloc message may not be executed immediately, which is determined by the dynamic system.