Thank you for your clarification, Romain! That is very helpful. I was
initially using a fixed final Drawable array for my switching
background images, and did not find any reason for memory leaks while
I did not have to wait long for hitting the heap limit, but I am aware
that it is easy to overlook such things. Even though my PNG background
images together take only about 35 KB on disk, the decompressed
versions will of course eat a lot more. Yet after moving over to using
a final Bitmap array for the same image set I had far less memory
related problems, and to further minimize memory usage I later changed
to loading images one by one by doing a BitmapFactory.decodeResource
(getResources(),) dynamically, only for the active background image.
DDMS currently indicates zero leakage for my app, but I do not know
how this was for my older breaking versions, because (at that time
being unfamiliar with DDMS) I initially had trouble getting the heap
info display to update.

I hope Mike can do some allocation tracking like you indicate, and
playing with some alternative implementations may help narrow down the
possible causes of his problems, which may be entirely different from
mine (and the one in the other thread).

Thanks

On Nov 15, 10:01 am, Romain Guy <[EMAIL PROTECTED]> wrote:
> Applications have a hard limit of 16 MB. As for the other bug you
> mention, it has nothing to do with memory usage; the implementation of
> BitmapFactory that reads images from URL will fail over slow
> connections. Besides, when you load a Drawable from the resources, it
> simply calls the BitmapFactory to decode the resource anyway.
>
> If you hit an out of memory exception, your app *is* using too much
> memory (which you might very well be "leaking," it's not that hard,
> especially if you use static fields in your code.) You can use DDMS
> and its allocation tracker, as well as its various GC/heap monitors to
> see when and how your application is allocating so much memory.
>
> I have run myself into this issue several times over the past 18
> months and every time, the application was leaking something
> (especially on screen rotation.)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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