HaoLiu's blog

ObjC Runtime Tips 01

Published on
Published on
/
1 mins read
/
––– views

Runtime , Self and Super with Init

   @implementation Son : Father
   - (id)init
   {
       self = [super init];
       if (self) {
           NSLog(@"%@", NSStringFromClass([self class]));
           NSLog(@"%@", NSStringFromClass([super class]));
       }
       return self;
   }
   @end

output:

NSStringFromClass([self class]) = Son
NSStringFromClass([super class]) = Son

Memory Management

What and where are the stack and heap?

  • What are the stack and heap?
  • Where are they located physically in a computer's memory?
  • To what extent are they controlled by the OS or language run-time?
  • What is their scope?
  • What determines their sizes?
  • What makes one faster?