IOS memory released

Source: Internet
Author: User

When I first came into contact with obj-C, I always had no idea what to release, what to release, and when to release. Although automatic reference counting is provided after xcode4.2, the IOS coder around me tells me not to use this because it is less efficient.

According to my understanding, there are two types of objects that need to be manually released, that is, those created by alloc and those created by new. The basic data types and cgpoint (struct) and bool (basic data types) are also written in

@ Interface {} does not need to be manually released.

To put it simply, only the @ property object in the H file and the alloc & new object in the M file need to be stored.

Objects to be released must first be converted to nil in viewdidunload, and finally be release in dealloc. All page Hard references, such as uitextview, need to be done in this way. Objects except page Hard references must be created, assigned values, and released immediately after use.

Follow the rule "if it is not assigned or retained, it does not need to be released"

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.