title: Reducing memory of UIImages from camera using Instruments
body: <p>My app, which uses ARC, does the following: </p>
  
  <ol>
  <li>Uploads a picture taken by the camera</li>
  <li>Compresses the picture for use as a thumbnail.</li>
  <li>I do this using [UIImage imageWithData:UIImageJPEGRepresentation( original, 0.1f )]</li>
  <li>I set the uncompressed picture reference to nil for ARC to free the memory</li>
  </ol>
  
  <p>Repeating this sequence will mean that several compressed thumbnails are on the screen. After about 7 or 8 pictures, the app wil crash due to low memory.</p>
  
  <p>In Instruments, I am attempting to use Allocations in tandem with Memory Monitor to find the source of my problem.  </p>
  
  <p><strong>Some Instruments stats:</strong></p>
  
  <p><em>Allocation</em> - Live Bytes jumps by about 2 MB after taking a picture, but then goes down by 1.5 MB after original picture reference is set to nil. That seems to be a good thing, but...</p>
  
  <p>Here's an eventual state of the application. #Living seems to be very high relative to the Live Bytes, right?</p>
  
  <pre><code>  Live Bytes  #Living   #Transitory  Overall   #Overall Bytes    
     3.72 MB    24538     80679        90.1 MB   105301
  </code></pre>
  
  <p><em>Memory Monitor (tracking inspection head)</em> - My application starts up at 7.5 MB and taking one picture results in that increasing by ~13 MB.  For the state that I listed above, Memory Monitor says that the app is taking up 72.67 MB of "Real Memory" and 123.79 MB of Virtual Memory.</p>
  
  <p>Given that the Live Bytes are very small, I know I'm doing <em>something right.</em>
  However, given that the memory footprint in other places is large, I'm also sure I'm doing something very wrong.  Any ideas what that might be, or how to track it down?</p>