aspose file tools*
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
Author

When will my thread sublclass be gc'ed

Sharif Muhammad
Greenhorn

Joined: Mar 01, 2002
Posts: 2
hi,
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);
vector.addElement(ct);
//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?
thanks.
Mark Herschberg
Sheriff

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.
--Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When will my thread sublclass be gc'ed