Lan Yi Education Record

Source: Internet
Author: User

A few days in a day lesson study the contents of file management, and left a photo album of the job

Also reviewed the contents of memory management:

Three methods commonly used in manual memory management (MRC)

Retain: Causes memory count +1

Release: Causes memory Count-1

Copy: Copies a new object and the data of the previous object may be consistent but not the same object memory count is 1

Autorelease: Automatically released when the variable is automatically released from the pool

Auto-Release Pool There's a lot of invisible in the project.

Attribute Description Keywords:

Retain/strong:

If retain would do two things,

-(void) Setnames: (Nsmutablearray *) names{

The first thing to release-1 the original

[_names release];

The second thing to pass in the new retain +1

_names = [names retain];

//

//

//}

1

2

3

4

5

6

7

8

9

10

The attribute life time retain plus 1 executes the Dealloc method when the current object is destroyed release-1

Assign/weak:

If this is the assign or weak set method, only one thing is done.

-(void) Setage: (int) age{

//

_age = age;

//

//}

1

2

3

4

5

6

7

Copy

If you're doing one thing in the copy set method

-(void) Setnames: (Nsmutablearray *) names{

//

_names = [names Copy];

//}

1

2

3

4

5

6

ReadOnly: If ReadOnly is used, the property will only generate a Get method without a set method

Nonatomic: Non-atomic Operation unsafe efficiency high non-multithreading are used Nonatomic

Atomic: Atomic operation thread security inefficient only when multiple threads access data can you use this keyword

All basic data types are assign or weak but because they are the default, you don't have to write anything.

All object types (except NSString) are used with strong or retain

NSString needs to be modified with copy to avoid a chain reaction that alters a string that causes a series of related strings to change.


Lan Yi Education Record

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.