Anonymous Inner Class has a strong reference of class itself. You may have to pass Context into it.
On Wednesday, September 10, 2014 12:00:36 AM UTC-4, Nathan wrote: > > I'm fairly sure I have been able to use the eclipse tools before to track > down memory leaks - I even found one in Google Analytics. > > But I can't for the life of me figure out. > > I have found out that there are two instances of Activity B in memory when > the activity is closed. I can see that with > > I know enough to know that that is bad. > > But what I cannot see is WHY. Why is that stupid activity still in memory > twice? > > I seem to remember that I right click on something and choose Merge Path > to GC Roots. > > Then I get something like this. > > > Class > Name > > | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap > > ------------------------------------------------------------------------------------------------------------------------------------------------------------------- > com.android.internal.policy.impl.PhoneLayoutInflater @ 0x42d2b0d8 > Unknown | 1 | 40 > | 536 | 64 > '- mPrivateFactory, mContext MyActivity @ 0x42d28230| 1 > | 536 | 536 | 127,336 > class com.android.internal.os.ZygoteInit @ 0x41a21a18 System > Class | 1 | 120 > | 536 | 1,000 > '- mResources android.content.res.Resources @ > 0x41aa7108 | 1 > | 112 | 536 | 8,512 > '- mContext android.app.ContextImpl @ > 0x43009398 | 1 > | 128 | 536 | 10,400 > '- mOuterContext MyActivity @ 0x42d4f008 | 1 > | 536 | 536 | 3,864 > > ------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Well that PhoneLayoutInflater shouldn't be holding on to that context of a > closed activity, but I don't think I control that. > And definitely that ZygoteInit thing shouldn't be holding a context in a > static way, but I don't control that either. > > Any tips on finding the causes better? > > Nathan > > > Nathan > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

