iOS MRC and Arc

Source: Internet
Author: User

1. Stack the local variables (release the code end, the system automatically recycles) stacking objects (dynamic allocation) 2. Allocate 4 bytes of storage space per object in the reference counter when the reference counter value is 0 o'clock the memory occupied by the object is automatically recycled, the initial value of the reference counter is 1.3.retain Reference counter +1   Release Reference Counter-14. You can send (call) Retaincount to the object to receive the value of the current reference counter 5. Rewrite Dealloc (object note) to determine whether to reclaim object memory, call [super Dealloc] (written at the end of the method) 6. Use the Alloc new copy retain counter to 1. As long as the above 3 appear, you must appear release or Autorelease;7.retain return is the call itself, Release has no return value 8. Wild pointer: A pointer to a zombie object (memory not available). Prevent wild pointers such as: P=nil;9.exc-bad-access accesses the memory that has been freed (wild pointer error). It is not possible to use retain after the zombie object. (Human death cannot be resurrected) 10. Zombie Object: An object that occupies memory that has been reclaimed. The retain parameter of 11.property only applies to OC Object type: Release old value, retain new value. 12.property Multithreading nonatomic High Performance, low atomic performance, generally used in Nonatomic13.property parameters setter: Determine the name of the set method, be sure to add a colon. Getter determines the name of the Get method 14. When the return value of a method is bool, it is prefaced with IS (specification) 15. Real-time object detection cannot be turned on in real-world development; 16. Using Nil to call methods in OC does not occur; 17. A memory leak is a non-used object that has not been destroyed in memory for 18. The @property parameter of one end object is used with assign19. The specification of a class referenced in the development of an inter-reference problem 1> declare Class 2> in. h files with a @class in the. m file # Import to contain all the things of the class 20. In the Dealloc method [Super Dealloc] to be written on the last side; 21. Regardless of whether the object is within the @autoreleasepool curly braces or not, As long as the autoreleasepool of the object is invoked within the curly braces 22. Only the Autoreleasepool method of the object is called in the scope of the auto-free pool to use 23. In the arc mechanism, you can no longer call release,retain and [Super dealloc];24. As long as there are no objects pointed to by the strong pointer, arc is automatically reclaimed immediately, by default all pointers are strong pointers; in 25.__weak, there are two weak pointers

MRC and Arc for iOS

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.