android - 如何关闭 Android Binder 线程?

标签 android

当我在 Android 设备监视器中分析我的应用程序时,我看到 Binder_1 Binder_2 Binder_3。当我不再需要这些线程以节省资源时,关闭这些线程的正确方法是什么?执行器有一个方法,shutdown,可以用来清理所有资源。安卓里有类似的东西吗?提前致谢!

最佳答案

What is the correct way to shut-down these threads when I no longer need them, to conserve resources

你不知道。这些是由框架管理的,而不是由您管理。

此外,由于绑定(bind)器线程通常会阻塞,除了一些少量的堆空间之外,我不清楚您希望节省哪些资源。

Over time it looks like the number of the number of these threads increases though which seems like a leak to me

制作一个重现行为的演示应用程序并 file an issue提供演示应用程序的源代码、重现问题的步骤以及您测试它的环境。如果您可以在官方 Android SDK 模拟器或 Nexus 系列设备上重现它,则可获得奖励积分。

Also if I don't need them is there a way to prevent them from being created?

我不知道你是如何确定是否需要它们的。毕竟,如果您的应用程序要运行,它将需要绑定(bind)器线程来执行此操作,以接收来自核心操作系统进程的传入通信(例如,广播 IntentsstartActivity() 请求)。同样,它们是由框架管理的,而不是由您管理。

关于android - 如何关闭 Android Binder 线程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30876365/

相关文章:

android - Ubuntu 16.04 : Android Emulator shows balck screen

要求Android服务每十分钟持续运行一次

android - 使用 Youtube Intent 从定义的起点启动视频

java - 将文件发送到 Http 时出现 OutputStream 内存不足错误

android - libspotify 在 Android 上因 SIGSEGV 而失败

Java 包名称和冲突

android - 同步ViewPager中的所有ListView

java - 随机访问数组,如何跳过重复项?

android - 如何设置自动提醒哪些数据来自数据库?

java - Udacity Sunshine android 应用程序 -- MainActivity.java 不一致 -- SDK 目标错误?