我有一个本地Android服务,它是通过GUI设置的属性启动和停止的。在init.rc中启动和停止服务的命令如下:
service myservice /system/bin/myservice
class late_start
user my_service
disabled
on property:persist.myapp.myservice.enable=1
start myservice
on property:persist.myapp.myservice.enable=0
stop myservice如果服务停止,需要清理JNI内存资源,但似乎服务是通过SIGKILL停止的:
6944 6974 V myservice: IMyProcessA::onTransact()
712 712 I AP_KERNEL: init: Service 'myservice' is being killed...
510 510 I ServiceManager: service 'ProcessA.MyService' died
656 656 V ProcessA: ProcessA::NotificationClient::binderDied()
656 656 V ProcessA: removeNotificationClient() 0xb6bc60a8, pid 6944
656 656 V ProcessA: ProcessA::NotificationClient::~NotificationClient()
712 712 I AP_KERNEL: init: Service 'myservice' (pid 6944) killed by signal 9
712 712 I AP_KERNEL: init: Service 'myservice' (pid 6944) killing any children in process group 既然没有办法拦截SIGKILL来清理,那么init.rc 'stop myservice‘是否有任何选项可以将终止信号更改为我可以拦截的东西,例如SIGTERM?
发布于 2019-01-11 07:04:50
您的“无内存泄漏”位于内核端,但是在一个进程结束之前,需要在用户空间中完成许多工作,例如,
.对于上述情况,发送SIGKILL是非常粗糙的。
https://stackoverflow.com/questions/38838044
复制相似问题