A humble opinion of iOS memory management

Source: Internet
Author: User

When we create an object with Alloc, new, and copy, the object's application count is 1, when the object is retain. Reference Count +1. When sending a release message to this object, reference count-1, when the object's reference count is 0 o'clock, the system recycles the object, when the pointer to this object is a wild pointer, to assign the wild pointer to nil, in addition, when the object reference count is 0 o'clock. The Dealloc method is called (self-overriding, in the end to invoke the [Super Dealloc] method, because the parent class also releases some objects, remembering that it was written last), when the object is called a Zombie object

Zombie object: An object that occupies memory that has been reclaimed. Zombie objects cannot be used (the object is dead and cannot be resurrected)

Wild pointer: Pointer to the Zombie object (memory not available), sending a message to the wild pointer will error (EXC_BAD_ACCESS)

Null pointer: No pointer to any object (stored memory is 0,nil,null), sending a message to a null pointer does not give an error

A humble opinion of iOS memory management

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.