IOS – commonplace memory management: a guide

Time:2020-11-28

Reading guide

During this period, I learned the memory management of Objective-C through the following materials:

The following articles are summarized

Outline:

IOS - commonplace memory management: a guide

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!