so we have to test our application's performance under this condition.
but it is not easy to case a low memory condition. is there a good way
to set up condition?
thank you!
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
I.e., user selects to load a new activity, system calls onPause() on
current activity, system launches new activity (onCreate(), etc.),
system calls onStop() on old activity, system runs low on memory -->
runs onDestroy() on old activity. Yes, I realize that onStop() and
onDestroy() aren't guaranteed to be run, but it isn't exactly clear
what condition affects whether these do or do not run.... Is it
related to the activity being within the same process as the
foreground activity? I.e., if it *is* within the same process, then it
runs the sane shutdown on the old activity, if it isn't, it brutally
kills the old processes?
From http://developer.android.com/guide/topics/fundamentals.html :
"onDestroy(): ....or because the system is temporarily destroying this
instance of the activity to save space."
Note that both cases *do* need to be tested independently, and killing
the process wouldn't be suitable for both cases (old activity in same
process as foreground activity, old activity in different process than
foreground activity).
On Jan 5, 4:30 pm, Dianne Hackborn <hack...@android.com> wrote:
> You can just use the shell to kill your app's process. All the system does
> when low on memory is select processes to kill to reclaim more, so your code
> will be going through pretty much the same experience if you manually kill
> it yourself.
>
>
>
>
>
> On Tue, Jan 5, 2010 at 1:18 AM, cht <caoht...@gmail.com> wrote:
> > for the developer, we must to deal with the "low memory" exception.
> > when other applications run forground, sometimes our application will
> > be killed for "low memory" reason .
>
> > so we have to test our application's performance under this condition.
> > but it is not easy to case a low memory condition. is there a good way
> > to set up condition?
>
> > thank you!
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "android-platform" group.
> > To post to this group, send email to android-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > android-platfo...@googlegroups.com<android-platform%2Bunsubscrib e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer
Really?
I was under the impression that there were several stages to
application shutdown, even in the event of memory shortages... onPause
(), onStop(), onDestroy()...
I.e., user selects to load a new activity, system calls onPause() on
current activity, system launches new activity (onCreate(), etc.),
system calls onStop() on old activity, system runs low on memory -->
runs onDestroy() on old activity. Yes, I realize that onStop() and
onDestroy() aren't guaranteed to be run, but it isn't exactly clear
what condition affects whether these do or do not run.... Is it
related to the activity being within the same process as the
foreground activity? I.e., if it *is* within the same process, then it
runs the sane shutdown on the old activity, if it isn't, it brutally
kills the old processes?
From http://developer.android.com/guide/topics/fundamentals.html :
"onDestroy(): ....or because the system is temporarily destroying this
instance of the activity to save space."
Note that both cases *do* need to be tested independently, and killing
the process wouldn't be suitable for both cases (old activity in same
process as foreground activity, old activity in different process than
foreground activity).
Which signal is sent to processes on low memory?
When this happens Android seems to remember which activity to start.
For instance:
- start your app opens activity1
- do something opens activity2 and finishes activity1
- go play with other applications or leave device idle until your process is killed by Android
- re-open your app by clicking on the icon
- the app is opened on activity2
When I kill the process manually, it always re-open on activity1.