Thanks. Working. Any chance to add a chapter on memory management in your online book - "Tuning Android Applications" ?
On Oct 31, 10:17 pm, Mark Murphy <[email protected]> wrote: > On Mon, Oct 31, 2011 at 3:51 PM, Efi Merdler-Kravitz > > <[email protected]> wrote: > > The biggest problem is the single image that I'm trying to load, it's > > a 250K gif image that gets inflated to almost 11MB. > > > How would you suggest lowering this number? > > One approach would be to use a lower-resolution image. > > > BTW why images get inflated so much when loaded into the memory ? > > GIF images use a technique known as "compression", as do JPEGs, PNGs, > MPEG videos, MP3 and OGG audio files, etc. To render the image, it > needs to be decompressed. "250K" is a meaningless value when it comes > to measuring memory consumption. > > Heap usage is a reflection of the number of pixels (resolution) and > the bit depth of each pixel (RGB_565 is 2 bytes/pixel; RGB_888 is 3 > bytes/pixel). Even if we assume that you are using RGB_888, 11MB would > still require more pixels than a 1080p display (1920x1080x3 is about > 6MB). That suggests that you are perhaps using a much too large image. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 4.0 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

