Basic Memory Policy of the database

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.