"Reading notes" Ios-coco memory management rules-owning objects

Source: Internet
Author: User

One, the event loop. A typical graphical application often spends a lot of time waiting for the user to operate. The program will remain idle until a decision is made very slowly by the person controlling the control, such as clicking the mouse or pressing a key. When such an event occurs, the program wakes up and starts working, performing certain actions necessary to respond to this event. After the event is processed, the program returns to hibernation and waits for the next event to occur. To reduce the memory footprint of the program, Cocoa creates an auto-free pool before the program starts processing events, and destroys the auto-free pool after the event processing finishes. This keeps the number of temporary objects that are accumulating to a minimum.

Second, the time for the auto-release pool to be cleaned is completely deterministic: either it is displayed in your own code, or it is destroyed using AppKit at the end of the event loop. You don't have to worry about how the daemon randomly destroys the auto-free pool. Because the auto-free pool is not destroyed when the function is called, you do not have to keep every object that you use.

Reference: "Object-c Basic Course"

"Reading notes" Ios-coco memory management rules-owning objects

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.