File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes When will my thread sublclass be gc'ed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "When will my thread sublclass be gc Watch "When will my thread sublclass be gc New topic

When will my thread sublclass be gc'ed

Sharif Muhammad

Joined: Mar 01, 2002
Posts: 2
i have a main server thread in its run method im creating child threads (ClientThread extends Thread):
while (true) {
//some code here....
ClientThread ct = new ClientThread(this);
//more code
in the client thread's constructor i invoke start, and in its run method i remove it from the vector before exiting.
when will client threads be garbage collected?
Mark Herschberg

Joined: Dec 04, 2000
Posts: 6037
It may be collected after the thread has finished executing, and all references to it removed. There's no garantee as to if or when.
subject: When will my thread sublclass be gc'ed
Similar Threads
Problem with Email Program in TCP
How must be chat app. with protocols ?
hello javacs...please help me...
button hang in threaded server