gpt4 book ai didi

android - 如何关闭 android Binder 线程?

转载 作者:行者123 更新时间:2023-11-29 00:10:11 25 4
gpt4 key购买 nike

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

最佳答案

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

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

此外,由于 Binder 线程通常会阻塞,在一些少量的堆空间之外,我不清楚您希望保留哪些资源。

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com