title: iOS autorelease pool blocks
body: <p>I was reading the documentation from apple about memory management when I got to <strong>autorelease pool blocks</strong> and something got me thinking.</p>
  
  <pre><code> Any object sent an autorelease message inside the autorelease pool block is  
   released at the end of the block.
  </code></pre>
  
  <p>I am not sure I fully understand this. Any object created inside an autorelease pool block gets released at the end of the block anyway because that is it's life span. Why would you need to call autorelease to the object when it is going to get released anyway when it reaches the end of the block?</p>
  
  <p>To be clearer, I will give an example, of what I am thinking: </p>
  
  <pre><code>   @autoreleasepool {
  
      MyObject *obj = [[MyObject alloc] init]; // no autorelease call here
  
      /* use the object*/
     //....
     // in the end it should get deallocated because it's lifespan ends, right?
     // so why do we need to call autorelease then?!
    }
  </code></pre>
  
  <p><strong>PS:</strong> Please don't tell me that because of ARC we don't need to do some things because ARC takes care of them. I am fully aware of that, but I want to leave ARC aside for just a few moments to understand the mechanism of memory management.</p>