IOS basic memory management series 4-autorelease method and @ autoreleasepool

Source: Internet
Author: User

  • When the autorelease method is executed, the object is added to the Auto Release pool.
  • When the automatic release pool is destroyed, all objects in the pool are automatically released for the release operation.
  • After the object executes the autorelease method, its reference counter will not change and the object itself will be returned.

  • Autorelease actually only delays the call to release. For each autorelease system, this object is only put into the current autorelease pool. When the pool is released, all objects in the pool will be called Release
  • Because only objects in the automatically released pool are destroyed, you do not need to worry about the object destruction time or when to call release.

 

  • Do not use objects that occupy a large amount of memory during operations. It is too late to release objects.
  • Objects that occupy less memory can use

 

<Foundation/Foundation. h> main (argc ,*{
Person * person = {Person * person2 = * person3 =

 

5. Common Errors

 

* Person =

 

* Person =

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.