Re: [android-developers] Re: Tracking down multiple Activity instances in memory

2014-09-18 Thread Nathan
I thought I was on to something. . . A colleague had a static textview and a static object that references a LoaderManager in another activity. No good reason, it wasn't proper communication between fragments, and the compiler probably prompted him to make them static in a Quick Fix. While it

[android-developers] Re: Tracking down multiple Activity instances in memory

2014-09-17 Thread Nathan
Should WeakReferences prevent garbage collection? I thought they were weak because they didn't prevent garbage collection. I am seeing that some of the Android classes are holding static collections of stuff. I can't see where I am causing that behavior, but I keep trying. In fact, some of

Re: [android-developers] Re: Tracking down multiple Activity instances in memory

2014-09-17 Thread Kostya Vasilyev
In my experience, WeakReferences are collected quite aggressively by Android 2.3 and higher. Haven't had a problem with non-static inner classes -- I don't think those are always a memory leak, it all depends on the lifespan duration of the inner object instances. I think MAT is a great tool for

[android-developers] Re: Tracking down multiple Activity instances in memory

2014-09-16 Thread Streets Of Boston
I had a similar issue once and I tracked it down to the View#setTag(int key, Object tag) method. In my code, setTag was called with a tag value being an object holding/referencing an instance that had children referring to children of the View on which this setTag was called (tag was a

[android-developers] Re: Tracking down multiple Activity instances in memory

2014-09-15 Thread Jonathan S
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