• Post Reply Bookmark Topic Watch Topic
  • New Topic

Destroying a thread  RSS feed

 
Glade Wishart
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have previously understood that when a thread is done processing it is automatically destroyed is this true without explicitly calling the Destroy() method or is it similar to garbage collection where you may be able to suggest garbage collection but it only occurs when the virtual machine is ready?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The latter. In fact this is garbage collection - the Thread object can only be freed from memory if there aren't any other (reachable) references to it. Some (many?) of the internal resources associated with running a thread may well be freed as soon as the thread completes the run() method - but the Thread object itself is dependent on GC.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!