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
bitmap_puppyicon = BitmapFactory.decodeResource(getResources(),R.drawable.puppy);
Where bitmap_puppyicon is a class variable of my extended SurfaceView. WHich means, I think, it is on the heap.
For bitmaps that are used once or twice or so, I created them on the fly in the onDraw() method.
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().
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?
It use skia under the hood, and heap is not the place where bitmaps live, In the heap you have links to bitmaps only