I don't know what you're doing with the Camera but a picture coming
from the Camera uses several MB of memory so...

One issue with Drawable is that they have a Callback pointer to a
View. That means if you keep your Drawable in a static field (directly
or indirectly), you forever keep a reference to a View. And that View
has a reference to the Context (your Activity), which has references
to all the widgets and resources on the current screen. That makes it
very easy to blow up the heap :)

On Sat, Nov 15, 2008 at 1:55 AM, blindfold <[EMAIL PROTECTED]> wrote:
>
> I forgot to mention that on the emulator I never had memory trouble
> even with my older versions: my app would run for over 1,300
> iterations without ever crashing whereas the G1 would crash with some
> OutOfMemoryError within 10 to 20 iterations. However, the camera part
> is of course very different for emulator and G1, so I cannot exclude
> the possibility that in my case the main problems originated there
> since it is now known that G1 camera programming must be done with
> white gloves. I did and do not have a G1 to look at possible memory
> leaks on the physical device.
>
> On Nov 15, 10:30 am, blindfold <[EMAIL PROTECTED]> wrote:
>> 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
>
> >
>



-- 
Romain Guy
www.curious-creature.org

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