Search code examples
javaandroidactivity-manager

Android application process gets killed automatically after running for some time


My android application gets killed automatically after running for some time (1 hour), this is the log that gets printed to the console when the process dies. Process <package name> (PID 21659) has died, and there are other services killed before my application gets killed which are not related to my application. Is this because of the not enough CPU resources available?

LOGS

09-10 17:34:49.959  1601    20644   I   ActivityManager Process com.qti.csm (pid 20762) has died
09-10 17:34:49.959  1601    20644   D   ActivityManager cleanUpApplicationRecord -- 20762
09-10 17:34:49.960  1601    20644   W   ActivityManager Scheduling restart of crashed service com.qti.csm/.securityLog.RunTask in 66531ms

09-10 17:34:50.670  1601    13143   I   ActivityManager Process com.razorlabs.cpumeter (pid 23212) has died
09-10 17:34:50.670  1601    13143   D   ActivityManager cleanUpApplicationRecord -- 23212
09-10 17:34:50.680  1601    13143   W   ActivityManager Scheduling restart of crashed service com.razorlabs.cpumeter/.services.ServiceWorker in 75810ms
09-10 17:34:50.695  1601    9564    I   ActivityManager Process com.android.inputmethod.latin (pid 23423) has died
09-10 17:34:50.695  1601    9564    D   ActivityManager cleanUpApplicationRecord -- 23423
09-10 17:34:50.695  1601    9564    W   ActivityManager Scheduling restart of crashed service com.android.inputmethod.latin/.LatinIME in 85795ms

09-10 17:34:50.774  1601    1601    W   InputMethodManagerService   Session failed to close due to remote exception
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService   android.os.DeadObjectException
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.BinderProxy.transactNative(Native Method)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.BinderProxy.transact(Binder.java:615)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:305)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.InputMethodManagerService.finishSessionLocked(InputMethodManagerService.java:1631)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.InputMethodManagerService.clearClientSessionLocked(InputMethodManagerService.java:1622)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:1648)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:1667)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1469)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1483)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.Handler.handleCallback(Handler.java:751)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.Handler.dispatchMessage(Handler.java:95)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at android.os.Looper.loop(Looper.java:154)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.SystemServer.run(SystemServer.java:363)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.server.SystemServer.main(SystemServer.java:230)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at java.lang.reflect.Method.invoke(Native Method)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
09-10 17:34:50.774  1601    1601    W   InputMethodManagerService       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

ActivityManager Process android.ext.services (pid 2274) has died
ActivityManager Process com.qualcomm.qcrilmsgtunnel (pid 2028) has died
ActivityManager Process com.android.smspush (pid 2093) has died

Device information: Processor: Qualcomm snapdragon 625 Operating system: Android N


Solution

  • Dan Baruch, thanks for the reply. I found that there is a memory leak in my JNI code, which is why android is killing my services and application. And the weird part is that the memory leak is happening very slowly and there are no logs which say this happens because of out of memory