[0, 2

Source: Internet
Author: User

[0, 2
I. Memory Management Overview

  • Garbage collection mechanism (GC): memory is managed by the system, which is not required by programmers.
  • Garbage collection in OC: add garbage collection in OC2.0.
  • OC and iOS: OC have a garbage collection mechanism, but iOS shields this function. Cause: iOS is running on mobile devices, with limited hardware resources (memory, power, heat control, etc.), and the garbage collection mechanism has some drawbacks (taking java's garbage collection mechanism as an example, its garbage collection does not recycle memory immediately after the program ends. Instead, it recycles memory only when the program requires memory and the remaining memory is not used by the program currently applying for memory ). That is, OC has a garbage collection mechanism. The iOS platform shields OC garbage collection, while Mac OS x has GC.
  • Therefore, developers need to manage the memory for software development on the iOS platform.
2. iOS Memory Management

Memory Management scope: Memory Management manages the heap memory.

Through iOSReference countMemory Management. After iOS5.0, Xcode added ARC (automatic reference count) to simplify memory management.

Memory Management Methods on iOS are divided into MRC and ARC. The difference between the two is that MRC uses reference counting by programmers to manage memory, while ARC manages reference counting automatically by the system.

Memory Management Principles:

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.