On Jun 22, 11:19 pm, Drifter <[email protected]> wrote:
> I don't seem to able to get a Thread to be garbage collected. Below is
> the source code (modified from HelloAndroid). I put a break point in
> the finalize function and it never seems to get called. If I remove
> "extends Thread" from the TestThread definition then the finalize
> function gets called as expected. What's going on?

What's going on is the implementation of java.lang.Thread is adding
the object to a ThreadGroup when the object is first created.
However, the ThreadGroup.remove() call is only made from inside the VM
when a thread exits.  Since the thread is never started, it's never
removed from the ThreadGroup, and you're leaking TestThread objects.

This would be a bug.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to