When I create a picture of about 2000x2000 pixels, it takes about 15MB in a heap. When I create 1500x2000 it takes about 12Mb.

But when I create more than 2000x2000 in DDMS for some reason, it shows that the maximum one-byte object occupies 1Mb. Although the heap itself is quite large, and working with a picture does not cause censures.

Why does DDMS give 1MB ??

alt text

  • four
    As far as I remember, under certain conditions, optimization is applied - the content of the Bitmap 'and is placed in the shadow heap , which, accordingly, is not counted in the application heap . Under what conditions and what exactly is happening - I suppose that it is unlikely to read in the android samples, in the documentation is unlikely. - falstaf
  • what may be the nuances? For example, I hope it does not affect the recycle work? - arg
  • 2
    No, it should not, because recycle , in fact, does nothing except mark pixel data Bitmap 'as dead and thus helps the GC on its next call. - falstaf

2 answers 2

Reply from comment:

As far as I remember, under certain conditions, optimization is applied - the Bitmap content is placed in the shadow heap , which, accordingly, does not count in the application heap .
Under what conditions and what exactly is happening - I suppose that it is unlikely to read in the android samples, in the documentation is unlikely.

This does not affect the work of recycle , since recycle , in fact, does nothing except mark pixel data Bitmap as dead and thus helps the GC on its next call.

    In bitmap there is a limit in the use of memory, if the picture exceeds the amount of memory pool, then departure with an error. This is solved by encryption or translation into texts. File or so - http://m.habrahabr.ru/post/139717/