Dark Horse programmer----Memory management of four--"Autorelease Automatic release Pool"

Source: Internet
Author: User

Memory Management Four--autorelease automatic release poolBasic use of 1.autorelease
    • This object method places the object in an auto-release pool ;
    • When the auto-release pool is destroyed , a release operation is made for all objects in the pool;
    • This method returns the object itself ;
    • After this method is called, the value of the object counter does not change until the auto-release pool is destroyed and the object is released once.
Benefits of 2.autorelease
    • Without the time when the object of concern was destroyed;
    • Do not care when to call the release operation;
use of 3.autorelease note
    • Objects that occupy large memory do not use autoreleasecasually;
    • Objects that consume less memory use autorelease without much impact ;
4. Wrong wording: Wild pointer error
    • Call Alloc after calling the Autorelease, followed by the release of the call;
    • multiple calls to autoreleasein succession;
5. Automatic release of the pool detail description
    • During the operation of the iOS program, countless pools are created that are present in the stack structure (advanced).
    • When an object calls the Autorelease method, the object is placed at the top of the stack;
other uses of 6.autorelease
    • The system's own method contains no alloc, new, copy, indicating that the returned objects are autorelease;

    • There are often some class methods in development that quickly create an already autorelease object:

7. Automatic release of pool creation
    • iOS5.0 ago
    • iOS5.0 start

Dark Horse programmer----Memory management of four--"Autorelease Automatic release Pool"

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.