androidandroid-6.0-marshmallow

Process being killed on Marshmallow but not on Lollipop


There's an existing application (several years old) where gets launched at device boot. On Lollipop everything is ok, however on Marshmallow, about 10 or 20 seconds or so after the app has started the process is being killed. There's no indication in logcat that there's any exceptions, the only thing that is logged when the process is killed is this line:

"I/ActivityManager﹕ Killing 3100:com.company.E/u0a85 (adj 15): empty #17"

Any idea what "empty #17" might mean if its anything significant. Or any suggestions how I can find out why its being killed?


Solution

  • Like @CommonsWare commented, it means your process has no running components. ActivityManager will keep empty processes around to speed up future launches, but only a limited number of them -- the default 32/2 = 16 on your device. Your app is #17, so it is killed.

    There is also a (lower) limit for the maximum number of apps that have been empty for more than 30 minutes. But that would give you a reason string of "empty for X s", rather than "empty #X".

    This is not new functionality in Marshmallow. Not sure why you haven't experienced it before. Maybe you have, but you didn't notice it. Maybe it happened late enough that you had time to finish your work. Or maybe your device's Lollipop/Marshmallow builds differ in some way (for example, an increased number of processes launching at boot and becoming empty, or different limit config in ProcessList.java?).

    Anyway, you can't depend on your process staying alive if you don't have an active component. Start a Service for your work -- and make sure to stop it when you're done.