title: Should memory be freed just before return statement in main?
body: <p>Consider this small program:</p>
  
  <pre><code>int main(int argc, const char *argv[])
  {
      int *i = new int;
      //do something with i, where i is involved all the time
      return 0;
  }
  </code></pre>
  
  <p>As a matter of good style and to show that you actually know you must free memory allocated on the heap you normally add <code>delete i;</code> just before return statement.</p>
  
  <p>But will it do any harm if leaving <code>delete i;</code> out?</p>
  
  <p>UPDATE: Please do not flame each other in comments. I do know that just to be on safe side and just as the matter of good style and so on I should free allocated memory. The question is, can it be ommitted <em>safely</em> in this <em>particular</em> case.</p>