Thanks for replying, Xavier.

Sorry if I'm missing something, but onDestroy() is called on the stack
of Activities in the Task.  The default behaviour of
Activity.onKeyDown() results in a call to Activity.finish(), hence the
onDestroy() call.  Thus, I would have expected onDestroy() to free
allocs?

I have 3 Activities (A, B and C).

A starts B, B starts C.  DDMS states that 2.673MB is allocated in
total.
** Going BACK and forth from C <-> B a few times and staying on B **.
DDMS states that 2.893MB is allocated in total.
>From B, BACK to A.  DDMS states that 2.890MB is allocated in total.
>From A, BACK is pressed to return to HOME.  DDMS states that 2.888MB
is allocated in total.

Cheers

James

On Apr 14, 10:17 pm, Xavier Ducrohet <[email protected]> wrote:
> When hitting back, the application that was at the front is simply
> paused. It is not destroyed or quit.
>
> This allows the app to "restart" instantly if you launch it again.
> However if the system needs more memory (to run new app) it can get
> killed automatically.
>
> You should read the lifecycle documentation 
> athttp://developer.android.com/guide/topics/fundamentals.html#lcycles
>
> Xav
>
>
>
> On Wed, Apr 14, 2010 at 2:04 PM, jamesc <[email protected]> wrote:
> > Hi
>
> > I've just started looking at DDMS with my app, and have been using the
> > Heap tool.
>
> > Whilst I observe memory allocations occur and the occasional freeing
> > up of memory upon GC, there is a general trend upwards.  I also
> > noticed this on the APIDemos example code.  Furthermore, when I press
> > BACK to return to the homescreen, I would have expected that all the
> > allocated memory (for the app) would have been freed.  Instead, I see
> > the 'allocated' value remain as it was before I pressed the BACK key.
> > Is memory management as straight forward as I am assuming, or is there
> > more to it than this?  Or am I misunderstanding what the Heap tool is
> > telling me?
>
> > Cheers
>
> > James
>
> > --
> > 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
>
> > To unsubscribe, reply using "remove me" as the subject.
>
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.
>
> Please do not send me questions directly. Thanks!

-- 
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