2011-02-15 12:58, Kostya Vasilyev skrev:
15.02.2011 14:41, Jonas Petersson пишет:
Well, I have not double checked for a while now, but the onLowMemory()
method of my service was certainly called now and then (even though my
service wasn't doing anything at all at the time) last I traced it.
Does this qualify?

It does qualify, but to a point:

http://developer.android.com/reference/android/content/ComponentCallbacks.html#onLowMemory()
This is called when the overall system is running low on memory, and
would like actively running process to try to tighten their belt.
While the exact point at which this will be called is not defined,
generally it will happen around the time all background process have
been killed, that is before reaching the point of killing processes
hosting service and foreground UI that we would like to avoid killing.

Note that it says "actively running process", "all background process
have been killed", and "before reaching the point of killing processes
hosting service and foreground UI" - which I'm reading to mean that this
applies to foreground-class processes.

The original question was, are *background* process heaps ever GC'd and
shrunk?

Was your service bound to a visible activity, previously called
startForeground, or running locally within a foreground process?

This was a while ago (1.1/1.5 IIRC) so there was no startForeground, but I'm pretty sure I used setForeground(true) to be less likely to get killed. It was completely invisible as all it did was the classic: look for unknown incoming phone numbers an look them up from web service (plus store in the phonebook). The gui was just a Toast. (Yes, I'm aware that there are ways to do this without a service - this was just something I did to play around with the system.)

                        Best / Jonas

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

Reply via email to