title: Bitmaps and Android Heap
body: <p>My app uses some bitmaps with a SurfaceView. For bitmaps that a recalled often I stored them as class fields, i.e. when my extension of SurfaceView instance is created I have</p>
  
  <pre><code>bitmap_puppyicon = BitmapFactory.decodeResource(getResources(),R.drawable.puppy);
  </code></pre>
  
  <p>Where bitmap_puppyicon is a class variable of my extended SurfaceView. WHich means, I think, it is on the heap.</p>
  
  <p>For bitmaps that are used once or twice or so, I created them on the fly in the onDraw() method.</p>
  
  <p>I checked out the heap in DDMS and felt I could afford to store more bitmaps as class variables instead of creating them in onDraw().</p>
  
  <p>To my surprise the heap size went down a few percentage points after doing this. Have I misunderstood something? Why would the heap get smaller with more bitmaps stored?</p>