My Github address

Notes on data Structures and Algorithms

Notes for geek Time iOS Developer Class

IOS large factory interview high frequency algorithm summary

Summary of iOS interview materials

Memory layout

24: Tagged Pointer

  • Stack: method invocation.
  • Heap: an object allocated by alloc, etc.
  • Text: program code.
  • BSS: uninitialized global variables, etc.
  • Data: initialized global variables.

Memory management scheme

  • TaggedPointer
  • NONPOINTER_ISA
    • Day 11: Isa details
  • Hash table
    • A weak reference table
    • Reference counter table

1. Hash table structure

SideTable structure

SideTables is a SideTable.

  • Because data is locked when it is modified, if all the tables of the objects are in the same sideTable, the locking is too frequent and efficiency suffers.

  • Because there are multiple SideTables, you can manipulate multiple tables asynchronously with less impact on each other.

4. How to implement fast triage (how to quickly locate its table through an object)?

  • The essence of SideTables is oneThe Hash table.
  • The Hash tableThe time complexity of search isO(1).
  • throughAddress of the objectThe Hash tablethecounttakedieGets the target value subscript index.

The data structure

1. Spinlock_t

Day twenty: Multithreading security risks

2, reference count table size_t

  • The reference count table is passedThe Hash tableTo achieve.
  • The Hash tableThe time complexity of search isO(1).

3, weak reference table weak_table_t

ARC & MRC

Retain implementation

2. Release implementation

RetainCount implementation

4. Dealloc implementation

4.1 object_disponse() implementation

4.2 cleanDeallocating() implementation

Weak reference management

1. How are weak-reference variables added to weak-reference tables?

2. How is the weak variable handled when an object is released?

  • According to theobject, look for toA weak reference tableTo extractWeakly referenced array.
  • Go through all of themWeak reference pointerAnd set tonil.

Automatic release tank

Autoreleasepool

  • How does Autoreleasepool work?
  • Why can Autoreleasepool be nested?

A circular reference

  • Self-circular reference

  • Cross reference

  • Multiloop reference

  • The examination site
    • The agent
    • Block
      • __block and block memory management
    • NSTimer
      • Day 23: Memory management – timer
    • Macrocyclic reference

Summary of the memory management interview

  • What is ARC?
  • Why is an object to which the weak pointer points automatically set to nil when deprecated?
  • How is Autoreleasepool implemented?
  • What is a circular reference? What circular references have you come across? How is it solved?