I just ran the ApiDemos app (from SDK 7) in a stand alone emulator.

I went to List1, then back, then to List2, then back, then back to
List1, etc... then:

1.) I used "adb shell ps" to view the process id.
2.) I used "adb kill -10 <pid>" to kill the process and dump an hprof
3.) I pulled the hprof from the virtual device's sdcard to my machine
4.) I converted the hprof with hprof-conv
5.) I opened the hprof with MAT in eclipse
6.) I opened OQL tab and ran "select * from
com.example.android.apis.view.List1"
7.) I see multiple instances of com.example.android.apis.view.List1
lingering in memory

On Mar 30, 5:01 pm, ivan <istas...@gmail.com> wrote:
> When I use MAT to look at TmpTestActivity, I ....
>
> 1.) Open the OQL tab in MAT and type the following query "select *
> from com.<package name>.TmpTestActivity" and run the query
> 2.) I right click on one of the TmpTestActivity result rows and choose
> "List Objecst -> with incoming references" ... the results of which is
> the same TmpTestActivity instance.
> 3.) I then right click on the result and choose "Path to GC Roots ->
> Exclude all soft/weak/phantom references", which results in:
>
>     i.) a ListView referencing the context of TmpTestActivity
>     ii.) a FrameLayout referencing the context of TmpTestActivity
>     iii.) an android.app.ContextImpl referencing the outer context of
> TmpTestActivity
>
> Note, if I run this test with an activity that doesn't contain the
> ListView I do not see extra activities sitting around in memory.
>
> On Mar 30, 4:35 pm, Romain Guy <romain...@android.com> wrote:
>
> > What exactly is leaking? What is the chain of references causing the leak?
> > If what you are describing is true it would affect pretty much every Android
> > application, which seems unlikely.
>
> > On Wed, Mar 30, 2011 at 2:23 PM, Mark Murphy <mmur...@commonsware.com>wrote:
>
> > > On Wed, Mar 30, 2011 at 5:14 PM, ivan <istas...@gmail.com> wrote:
> > > > I'm using a deice.
>
> > > You should be testing this on an emulator in addition to your device.
> > > Your device may have its own set of bugs and (strangely enough) the
> > > home screen can impact this sort of thing as well. For a problem like
> > > this, the emulator will be a truer test of what the unmodified Android
> > > code will do. Use a standalone emulator and the standalone DDMS
> > > (tools/ddms from your SDK installation) to ensure Eclipse is not the
> > > one causing you difficulty.
>
> > > On the plus side, I didn't realize you could dump the heap of a
> > > process that's running on hardware, so that's good to know.
>
> > > --
> > > Mark Murphy (a Commons Guy)
> > >http://commonsware.com|http://github.com/commonsguy
> > >http://commonsware.com/blog|http://twitter.com/commonsguy
>
> > > _The Busy Coder's Guide to *Advanced* Android Development_ Version
> > > 1.9.2 Available!
>
> > > --
> > > 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
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > Romain Guy
> > Android framework engineer
> > romain...@android.com
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support.  All such questions should be posted on public
> > forums, where I and others can see and answer them

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to