IOS memory release Principle

Source: Internet
Author: User

1. Keep the Count of objects created by allocation or replication 1
2. Assume that the object obtained by any other method is counted as 1 and is in the Auto Release pool. To use this object outside the current execution range, you must keep it
3. It is maintained when an object is added to the set, and is released when the object is removed from the set. Releasing the set object will release all objects in the set.
4. Make sure that the number of alloc, copy, mutablecopy, or retain messages is the same as the number of release or autorelease messages that are sent to this object. In other words, make sure that yourCodeBalance
5. Set the attribute in the access method and keep it before releasing (ztime: @ propperty and @ synthesize commands automatically create this code)
6. The nsstring object created with the @ "..." structure is a constant. Sending release or retain has no effect.

Related Article

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.