On Wed, Oct 21, 2009 at 3:43 AM, Mika <[email protected]> wrote: > Well basically because if I want to do some background processing > (playing music, tracking location etc.) while the user is doing other > things I would want my process to use memory as little as possible so > that the system wouldn't kill it. But if my UI i.e. Activities stay in > the memory even when they are not used it makes the background process > more likely to be killed.
The size of your process doesn't make it more likely to be killed. And again, if your activity is actually being finished (by you calling finish() or the system doing that for you as a result of you pressing back in it), then all of the objects associated with the activity will be released. Unless you have leaked some references to it, such as in static variables. You can use the hat tool to look at the objects in your process, and follow the references to see why some aren't being garbage collected. Of course if you press home to leave the app, then the activity is still in use, and will remain around if or until the process is killed. If you want to reduce memory use while in this state, you can put code in onStop() to free up any heavy-weight resources (such as large bitmaps), and reload them on onStart() on onRestart(). > I also tried using some memory extensive > apps (Maps, Browser, Camera) but the system still didn't free the > activities of my app. > Using memory in other apps has -nothing- to do with "freeing" memory in your app. All it can result in is some not-needed processes being killed if the kernel is running low on available memory. Sorry, I don't have time to debug your app. -- 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 -~----------~----~----~----~------~----~------~--~---

