(Apologies for double-post... Xoom Honeycomb browser crashed twice
upon posting!)

Also an edit to my previous post:
Click Histogram again and search for the extra objects. Right-click
and click "Merge Shortest Path to GC Roots" and look for the "exclude
all phantom/weak/soft etc. references".

You'll want to do the same for the 'fresh' Histogram and see who is
keeping your objects alive. The target is to make the total (at the
bottom) equal on both the fresh and 'after-routine' Histogram.

I have only used this on Android 2.2 and 3.0. It is good to test this
on as many versions as you have access to, as you may find that
certain builds may leak more objects than others (the Galaxy Tab stock
2.2 seems to leak a bit compared to CyanogenMod 7.0.0 on 2.3).

Also, while 3.0 has the very helpful ability to see that your Bitmaps
are leaking as byte[] objects, you can already see if your code is
leaking with 2.2. A leak doesn't have to have a large footprint
especially in 2.2 where a harmless-looking AsyncTask may leak Bitmaps
but show minimal memory use.


On Jun 6, 3:00 am, B Lyon <[email protected]> wrote:
> what version of android?
>
>
>
>
>
>
>
> On Sun, Jun 5, 2011 at 2:51 PM, albnok <[email protected]> wrote:
> > Comment everything out. Make a routine where you rotate and go in and
> > out of the activity. Start activity fresh, do hprof dump, do the
> > routine, get another dump. Click Histogram and click the right most
> > icon to compare to the fresh dump. You may spot some extra objects.
> > Click Histogram again and search for the extra objects. Right-click
> > and look for the "ignore phantom/weak/soft references" (not at
> > computer, don't remember exact menu). You may find orphaned objects
> > e.g. Matrix as a result of doing m = new Matrix() when you can reuse
> > with m.reset(). Aim for zero gain before uncommenting blocks of code
> > to find the leak(s).
>
> > On May 14, 12:38 am, olivier <[email protected]> wrote:
> > Comcommentment > Dears,
>
> >> I am metting an OutOfMemory exception after a while, while inflating
> >> an XML View with a bitmap.
>
> >> The problem occurs after opening many times activities that are using
> >> many bitmap but always inflated from the XML.
>
> >> I check with MAT the Memory.
> >> First question : I don't retain any of my Activity in memory - If I
> >> filter on the name of my Activity, i get Objects = 0, but on some
> >> activities I could see RetainedHeap >= 302. Does this indicate a
> >> leak ?
>
> >> After that, I try to compare my memory in different points of time, to
> >> see the objects that have been created. But I can't find any thing
> >> significant.
>
> >> My Question is : If I don't retain activities in memory what could be
> >> the leak reasons ?
> >> What tools/Method to use to find it ?
>
> >> Regards,
>
> >> Olivier
>
> > --
> > 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

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