Thursday, June 24, 2010

[android-developers] Re: Testing Low Memory and onDestroy

I learned that a single application has a memory limit. So my test was
flawed. I was trying to get the low memory and destroy methods called
on one application by using a lot of memory in another application.
Won't work. Those methods are called when there is a system wide low
memory condition. My app that consumes memory just used up its max
amount of memory then crashed. It did not have the effect on the
system wide memory that I wanted it to. Good to know..

On Jun 21, 5:03 pm, Ayyrk <ayyr...@gmail.com> wrote:
> Testing onDestroy.
>
> Q: does using a lot of RAM in one application always lead to onDestroy
> being called on Activities in other applications?
>
> To try and figure this out I created two separately installed
> applications. The first just logs its lifecycle transitions and the
> second allocates a chunk of memory each time you press a button.
>
> What I saw was the second application eventually suffered a fatal Out
> Of Memory Error force close. The onDestroy method was not called on
> the first logging application and when I switched back to it onResume
> was called.
>
> My conclusion is that using a lot of memory in a single application
> will lead to a fatal Out Of Memory Error without onDestroy first being
> called on Activities in other applications. The documentation left me
> expecting an onDestroy on the logging application since the foreground
> application was trying to allocate more memory.
>
> Does the above sound right? What's a good way to test the onCreate/
> onDestroy lifecycle methods as they relate to low memory?

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

No comments:

Post a Comment