Reading guide
During this period, I learned the memory management of Objective-C through the following materials:
- Objective-C Advanced Programming: IOS and OS X multithreading and memory management
- Advanced memory management programming guide:Advanced Memory Management Programming Guide
- Transition to arc release notes:Transitioning to ARC Release Notes
- Open source runtime code maintained by Apple:https://opensource.apple.com/tarballs/objc4/
The following articles are summarized
- IOS – reading Objective-C Advanced Programming: IOS and OS X multithreading and memory management
- IOS – commonplace memory management (1): reference counting
- IOS – commonplace memory management (2): from MRC
- IOS – commonplace memory management (3): Arc
- IOS – commonplace memory management (4): source code analysis of memory management methods
- IOS – commonplace memory management (5): tagged pointer
- IOS – commonplace memory management (6): talk about autorelease and @ autorelease pool
- IOS – commonplace memory management (7): a bloody case triggered by an interview question
- IOS – commonplace memory management (8): related interview questions
Outline:
Here are some of the memory management issues. If you have doubts or vague answers to the following questions, this series of articles can help you.
- What are the memory management solutions for IOS?
- Talking about memory management mechanism of IOS
- How does the reference counting mechanism work?
- Where is the reference count stored? Where was it stored before? And now?
- Can you talk about isa? What is nonpointer?
- Have you seen sidetable? What is it used for?
- How to manage the reference count, can you talk about the implementation of memory management method?
- Talk about the memory management rules under MRC?
- When does MRC need to send a release message to an object? When to use autorelease?
- Why not use accessor methods in initialization methods and dealloc?
- Why is self = [super init] needed in initialization method?
- Can you talk about the principle of super?
- Arc memory management rules?
- Is there no retain / release method under arc?
- Do you know about toll free bridged? Describe it in detail.
- What are the ownership modifiers?
- How is the weak variable set to nil after the object is destroyed, and how does the runtime implement it?
- The process of runtime assigning value to the weak variable?
- Since__ Weak is safer, so why__ Weak wants to keep it__ unsafe_ unretained ?
- How do circular references come into being? How to avoid circular reference in MRC?
- What are the situations in arc that generate circular references? How to solve it?
- To release the nsautoreleasepool object, use the difference between [pool release] and [pool drain]?
- @How much do you know about autorelease pool?
- @The principle of autorelease?
- When do you need to create @ autorelease pool?
- In the arc environment, when will the local objects in the method be released?
- When will the autorelease object be released in the arc environment?
- In the arc environment, do you need to manually add @ autoreleasepool?
- What is tagged pointer?
- How to judge tagged pointer?
Reading attention
To avoid semantic confusion, the word “release” in all articles refers torelease
“Destruction” meansdealloc
。
If you find any errors in your reading, please point them out.
It’s not easy to summarize. Please pay attention to it!