Interesting.  Thanks for the lead.  I'll look into this an report back
either way.

On Oct 10, 1:48 am, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> Then you should check carefully where exactly you pass your Activity
> (or Context) to other classes/APIs, etc. The Context is used by many
> different classes in the Android framework and if you somehow "leak"
> the Context, you leak all the views, images, etc. Your issue is very
> similar to several issues we fixed over the past few months: on each
> rotation the Context leaks and everything leaks with it. You can use
> DDMS to check how the heap is growing after each rotation, it should
> tell you whether this is the problem or not.
>
>
>
> On Fri, Oct 10, 2008 at 1:44 AM, songs <[EMAIL PROTECTED]> wrote:
>
> > Nope, the only static variables I have are constants.  I do keep an
> > array of Drawable in the view, but that's an instance variable.
>
> > On Oct 10, 1:14 am, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> >> Looks like you're leaking memory somewhere. Do you keep a static cache
> >> somewhere in your app?
>
> >> On Thu, Oct 9, 2008 at 10:02 PM, songs <[EMAIL PROTECTED]> wrote:
>
> >> > Hi,
>
> >> > I think that either I've stumbled onto a bug or I'm missing something
> >> > on how to manage my resources.  I have an activity with a Java based
> >> > view that contains 30 or so small images (~2k each .png) that are
> >> > loaded into an array when the view is created.  In "normal" operation,
> >> > everything runs fine.  When I flip the orientation between landscape
> >> > and portrait 3-4 times, I get the following:
>
> >> > E/AndroidRuntime(  472): java.lang.OutOfMemoryError: bitmap size
> >> > exceeds VM budget
> >> > E/AndroidRuntime(  472):        at
> >> > android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
> >> > E/AndroidRuntime(  472):        at
> >> > android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:290)
> >> > E/AndroidRuntime(  472):        at
> >> > android.graphics.drawable.Drawable.createFromStream(Drawable.java:635)
> >> > E/AndroidRuntime(  472):        at
> >> > android.content.res.Resources.loadDrawable(Resources.java:1440)
> >> > E/AndroidRuntime(  472):        at
> >> > android.content.res.Resources.getDrawable(Resources.java:498)
>
> >> > When the orientation gets changed, the activity seems to go through
> >> > the entire lifecycle (pause, stop, then create again).  A new instance
> >> > of the activity's view is created in the onCreate method and it seems
> >> > that the pause/stop steps in the lifecycle don't clean up the old
> >> > view.  I've tried explicitly setting the reference to the view to null
> >> > in onPause and doing a System.gc(), but that doesn't seem to help.
> >> > I've also tried setting the requested orientation to portrait in hopes
> >> > that the activity would then ignore orientation changes, but that
> >> > didn't work either.  GC messages come up after every orientation
> >> > change so one would think that the garbage collector was doing its
> >> > job.
>
> >> > I could just leave this be and assume people aren't going to be
> >> > randomly flipping their phone open and closed while they're using my
> >> > app, but that seems pretty sloppy.  I'd like to know what's going on
> >> > here and fix it.
>
> >> > Any ideas?
>
> >> > Thanks,
> >> > Steve
>
> >> --
> >> Romain Guywww.curious-creature.org
>
> --
> Romain Guywww.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 [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