Hi Peter, thank you for your reply. However, please read my question carefully. I'm asking about a specific case, when Android OS "kills" a SERVICE (an application component) separately, without killing entire PROCESS. Please check your own links. You pointed at final void killServicesLocked(ProcessRecord app, boolean allowRestart) but it is called from private final void cleanUpApplicationRecordLocked(ProcessRecord app, boolean restarting, boolean allowRestart, int index) This method has a javadoc comment stating that "Main code for cleaning up a process when it has gone away. This is called both as a result of the process dying, or directly when stopping a process when running in single process mode." Cleaning up a PROCESS, not a single SERVICE inside a PROCESS. Android LowMemoryKiller works with Linux PROCESSES, not with application components like SERVICES. Application components only influence PROCESS priority, so that LowMemoryKiller can make a decision. But LowMemoryKiller kills entire PROCESS.
Thank you, Alex On Tuesday, December 9, 2014 2:01:12 AM UTC+1, Peter Teoh wrote: > > *The Service can still be killed by Android.* > > > Any proofs? > > not any proofs, but just some discussion is possible: > > Read this: > > > http://developer.android.com/reference/android/content/Context.html#startService%28android.content.Intent%29 > > From above, there is a line: > > The only time they should be stopped is if the current foreground > application is using so many resources that the service needs to be killed. > > This is talking about the OOM killer. > > In traditional Linux OOM is initiated from the kernel. But here in > Android there is a special lowmemorykiller daemon: > > https://source.android.com/devices/tech/low-ram.html (looked out for > lowmemorykiller, the name as it is) > > Under Android source code: > > > frameworks/base/services/core/java/com/android/server/am/ActiveServices.java: > final void killServicesLocked(ProcessRecord app, boolean allowRestart) > { > > > frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java: > mServices.killServicesLocked(app, allowRestart); > > You can see the caller and the implementer of the function above. It is > where BIND_ALLOW_OOM_MANAGEMENT parameter are checked, and thus killing the > services is done if necessary. > > More info: > > > http://stackoverflow.com/questions/18972590/the-timing-to-start-android-low-memory-killer > > http://forum.xda-developers.com/showthread.php?t=904023 > > And this is from Linux kernel source code (under drivers/staging/android > means it is still yet to be approved by linux kernel - at that time): > > > http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/drivers/staging/android/lowmemorykiller.txt > > http://www.programering.com/a/MjNzADMwATE.html > > http://lwn.net/Articles/511731/ > > http://varun-anand.com/mem_mgmt.html > > Regards, > Peter Teoh > -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.