Summary of objective-C Memory Management

Source: Internet
Author: User

1. When you create an object using new, alloc, or copy, the Count retain of the object reaches 1. You must delete this object release or autolease. In this way, it can be cleared only when its lifecycle ends.

2. When you use other methods to obtain an object, you can think that it has retaken a count and autolease has fallen. You don't have to worry about cleaning problems related to it. But if you want to keep this object, you need to retain it and make sure that you release it later.

3. If you retain an object, you always need release or autolease.

These three rules are being writtenCodeYou must comply with the rules. Once you comply with the rules, there will be no memory leakage issues.

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.