OC, oc Language

Source: Internet
Author: User

OC, oc Language

I. Reference Counter

1> stack and stack

2> Introduction

3> Basic Concepts

4> Basic Methods

Ii. multi-object memory management

1> basic usage

  • When an object exists, the retain operation is performed on the object.
  • When an object is discarded, the release operation is performed on the object.
  • If the retain operation is performed, the release operation is performed.

2> memory management of the set Method

3> @ property impact on memory

4> loop inclusion and circular reference

Iii. autorelease

1> basic usage

2> usage notes

  • The creation and release of the automatic release pool follow the stack rules.
  • Calling the autorelease method does not affect the reference counter.
  • The autorelease method delays the object release time. Do not use objects that occupy a large amount of memory.
  • An object cannot call the autorelease method multiple times.
  • An object cannot use both the autorelease method and the release method.

3> common applications

  • Quickly create an object that automatically releases the pool

    ① A class method is usually designed to quickly create an object in the Auto Release pool ② The method name usually starts with the class name ③ when the class is created, use self to call the alloc, init, and autorelease methods. Do not use the class name

     

Iv. ARC

1> basic usage

2> @ property's strong and weak Parameters

  • The strong parameter is equivalent to the retain parameter.
  • The weak parameter is equivalent to the assign parameter.

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.