If you just need the activity cleaned up immediately for testing
purposes then there is an app on the emulator called "Dev Tools" that
might help. Run the app, choose the "Development Settings" option,
then check the "Immediately destroy activities" option.

On Oct 20, 4:23 pm, jotobjects <[email protected]> wrote:
> Hi Mika -
>
> One more question - why do you expect the system to close the Activity
> and free the memory?  Even though the Activity is not visible the
> system can keep it alive unless it needs to free memory.  I think you
> would need to finish() the Activity yourself or fill up memory in the
> Service to see if the Activity is finally removed.
>
> On Oct 20, 11:39 am, jotobjects <[email protected]> wrote:
>
> > What happens if you override finish() to see if it gets called?
>
> > What does Dianne mean by "let the system finish the activity", i.e.,
> > what causes finish() to be called?
>
> > On Oct 20, 1:48 am, Mika <[email protected]> wrote:
>
> > > So has anybody been able to test the sample app and found the leak. To
> > > me this seems a quite serious bug or I might have misunderstood some
> > > fundamental Android concept. But I doubt that it is desired behavior
> > > to leave Activities (or at least not its views) in memory when they
> > > are not used.
>
> > > -Mika
>
> > > On Oct 16, 12:11 pm, Mika <[email protected]> wrote:
>
> > > > Hi Dianne,
>
> > > > This is what I assumed also. Do you have any ideas where the leak
> > > > could be in the sample app that I posted? I also checked the music
> > > > player app with meminfo and it behaves similarly leaving activities in
> > > > memory even after the ui is closed and system_process and
> > > > com.android.music processes are GCed from DDMS. I also tested with 1.1
> > > > SDK and Emulator and there everything works as presumed and no
> > > > activities stay in memory after they are closed.
>
> > > > -Mika
>
> > > > On Oct 15, 7:56 pm, Dianne Hackborn <[email protected]> wrote:
>
> > > > > If you press back and let the system finish the activity, all 
> > > > > references to
> > > > > it will be gone, so though your process is there after it GCs the 
> > > > > resources
> > > > > (views etc) associated with the activity should be gone.  If you 
> > > > > still see
> > > > > them after you know the process has GCed, then you have a leak in 
> > > > > your app.
>
> > > > > On Thu, Oct 15, 2009 at 7:57 AM, String 
> > > > > <[email protected]>wrote:
>
> > > > > > On Oct 15, 3:08 pm, Mika <[email protected]> wrote:
>
> > > > > > > So the problem is quite simple. I start a Service from an 
> > > > > > > Activity,
> > > > > > > the user presses back, the Activity goes away and the Service 
> > > > > > > stays
> > > > > > > running in the background. However the activity (and it's views) 
> > > > > > > still
> > > > > > > stay in memory.
>
> > > > > > Feature. It's central to the Android architecture that activities
> > > > > > aren't killed by the system until their resources are needed
> > > > > > elsewhere. The idea, I think, is that if the user goes back into 
> > > > > > your
> > > > > > activity before that happens, it's ready and waiting.
>
> > > > > > Some good discussion of it in this thread:
>
> > > > > >http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > > > > > String
>
> > > > > --
> > > > > Dianne Hackborn
> > > > > Android framework engineer
> > > > > [email protected]
>
> > > > > Note: please don't send private questions to me, as I don't have time 
> > > > > to
> > > > > provide private support, and so won't reply to such e-mails.  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 [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