Thank you Streets of Boston for your response,

This was just a test project. I was using a 4MP image to get at that
precisely to determine how much images we can use in a layout.

If an UI uses a lot of drawables that combined uses a lot memory,
application will be at some point Out Of Memory errors. We are working
on an application which its UI is based mostly on images (drawables)
and also download images to present "thumbnails" of items, making your
suggestion of "nulling" references of those images really complicated
since most of the items that uses images are not retrieved using
findViewById method.

-f4

On Apr 29, 2:58 pm, Streets Of Boston <[email protected]> wrote:
> How big is drawable/domo2048?
> Is it 4MPixel. This means that, in the best scenario, it occupies 8Mbytes.
> Then, depending on how you show it, you have a scaled (down) version of the
> image as well.
>
> Note that the memory held by the raw data of the image (the 8Mbytes if
> RGB_565 is used) is not 'seen' by the DalvikVM. This causes the DalvikVM not
> to call the garbage collector when it actually should (DalvikVM thinks the
> memory limit has not yet been reached to warrant a call to the garbage
> collector, because it doesn't 'see' the 8MByte of your image).
>
> This means that even if there is 8Mbyte available but not in one contiguous
> chunk of memory, you may get an out-of-memory error.
>
> Try this: in onDestroy, set the background-drawable of the ImageView with
> id=R.id.domo2048 to null and call System.gc(). See if your memory issues get
> any less.
>
> As a side note:
> Don't assign 4MPixel images to small screens. You'll be waisting a LOT of
> memory. :)
> Pre-scale the image to one that would fit on the phone with the largest
> screen that you support, not any bigger than that.

-- 
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

Reply via email to