Lan Yi Education Memory management

Source: Internet
Author: User

Stack area: Contains the basic data type and object address, no need to consider the memory release problem

Heap area: Freed by programmer assignment. If the programmer does not release, the memory will never be released, causing a memory leak. In iOS, Alloc created objects are placed in the heap area.

The Alloc command causes a memory count of +1

Who's in charge?

The keywords inside the attribute brackets are used to control the contents of the set and get methods.

Retain (strong) will let the set method do two things 1. Release the original value 2. The value of the new pass in retain

Assign (weak) will allow only one thing in the set method to assign the value passed in to the global variable and memory count Independent

The base data type is assign by default with assign (weak)

Object type with retain (strong)

Lan Yi Education Memory management

Lan Yi Education Memory management

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.