title: Simple iPhone app uses too much memory (4MB)
body: <p>Thank you for your Time
  I'm using:</p>
  
  <ul>
  <li>XCode 4.0 Build 4A304a</li>
  <li>IOS 4.3.1</li>
  <li>Running on an iPhone 4</li>
  </ul>
  
  <p>I just created a project with the navigation template.
  The app does nothing, the table has only one row, and when you tap on this row it checks how much memory is used by the app and writes the result on the <code>detailTextLabel</code>.
  This app uses 4MB. Is this normal?</p>
  
  <p>Here's the code I use to get the memory info:</p>
  
  <pre><code>- (float) reportUsedMemoryInBytes {
  
      struct task_basic_info info;
      mach_msg_type_number_t size = sizeof(info);
      kern_return_t kerr = task_info(mach_task_self(),
                                 TASK_BASIC_INFO,
                                 (task_info_t)&amp;info,
                                 &amp;size);
      if( kerr == KERN_SUCCESS ) {
          return info.resident_size;
      } else {
          NSLog(@"Error with task_info(): %s", mach_error_string(kerr));
          return -1.0;
      }
  }
  </code></pre>
  
  <p>The label is filled with</p>
  
  <pre><code>cell.detailTextLabel.text = [NSString stringWithFormat:@"%.2f Mb", 
                               [self reportUsedMemoryInBytes] / 1024.0 / 1024.0];
  </code></pre>
  
  <p>When using Instrument with memory monitor if i scroll down i see my process which is named MemTest.</p>
  
  <ol>
  <li>In the Real Memory Column stays <strong>4.58 Mb</strong>  </li>
  <li>In the Virtual Memory Column stays <strong>75.78 Mb</strong></li>
  </ol>
  
  <p>However if i go with Allocations and check the first row <strong>all Allocations</strong> then</p>
  
  <ol>
  <li>In the Live Bytes Column stays <strong>631.51 Kb</strong></li>
  <li>In the Overall Bytes Column stays <strong>1.26 Mb</strong></li>
  </ol>
  
  <p>What is now the right amount of Memory this simple App uses ?
  I want to know only how much memory is used by my App without the stuff that is used by Frameworks and IOS Librarys.</p>
  
  <p>Thanks to every Body for some help.</p>