WTK 模拟器上的线程真的没有被垃圾回收吗?

发布于 2024-07-30 09:28:57 字数 303 浏览 4 评论 0原文

当我说在 WTK 模拟器(v 2.5.2_01)上运行时,我的 J2ME 应用程序中的 Thread 对象似乎没有被垃圾收集时,我很确定我不会生气。

当我的运行方法退出时,我有一条控制台消息,并且它被打印出来。 同时,我回调唯一一个拥有线程引用的对象,并告诉它将其引用清空,它确实这样做了。

然后我稍后以完全相同的方式启动一个新线程。 每次启动一个新线程时,WTK 内存监视器上的 Thread 对象的数量都会增加 1。 它永远不会下降。 启动足够多的线程,最终我的应用程序开始变慢。

这是 WTK 中的已知错误吗?

I'm pretty sure I'm not going mad when I say that Thread objects do not seem to be garbage collected in my J2ME application when running on the WTK emulator (v 2.5.2_01).

I have a console message when my run method exits, and it is printed. At the same time I make a call back to the only object that has a reference to the thread and tell it to null its reference, which it duly does.

I then start a new thread later on in exactly the same way. Every time I start a new thread, the number of Thread objects on the WTK's memory monitor goes up by one. It never goes down. Start enough threads and eventually my app starts to slow down.

Is this a known bug in the WTK?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清风夜微凉 2024-08-06 09:28:57

您是否绝对确定没有其他对象包含对此线程的引用,并且该线程实际上不可能仍在执行任何操作?

Are you absolutely positive no other object contains a reference to this Thread, and that there is no way that this Thread is actually still doing anything?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文