views:

42

answers:

2

I'm currently debugging my app which is quite complex and has up to 5 activity levels. In order to detect memory leaks (i.e. activities that aren't removed from memory even finish() is called, due to some references held somewhere) I want to check which activities are still alive in memory.

Currently I create hprof dumps, but it's not very convenient, cause every time I need to mount the sdcard, copy the hprof dump file from the sdcard to my PC, etc.

(Side note: I already tried to automate the pulling of my hprof file more easily, but I'm on an unrooted device and adb pull <hprof file> won't let me / no permission.)

Therefore I am wondering, if all I want to know is IF and WHICH activities are still currently alive in my memory, is there a way through the Android API or any other way on-the-fly with which I can achieve this (list all alive activities of my app), programatically.

A: 

cause every time I need to mount the sdcard, copy the hprof dump file from the sdcard to my PC, etc

You can use Eclipse's File Manager view while your phone is in Debug mode to copy data from your device, without mounting the SDCard.

Pentium10
Ok, I don't use Eclipse but IntelliJ; but I just see that I mistyped the adb command, should be adb pull, not adb shell pull. When pulling from sdcard, it should be ok then also via command line. But still, it's quite time consuming having to pull, convert and open the hprof in the profiler, etc.Any instant way via API to see the activities of the app in memory (without hprof) and logging it out to logcat?
Mathias Lin
A: 

I figure there's no way to visualize the activity stack within Android itself.

Mathias Lin