File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes Destroying a thread Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Destroying a thread" Watch "Destroying a thread" New topic
Author

Destroying a thread

Glade Wishart
Ranch Hand

Joined: Nov 03, 2000
Posts: 30
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

Joined: Jan 30, 2000
Posts: 18652
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.


"I'm not back." - Bill Harding, Twister
 
 
subject: Destroying a thread
 
Threads others viewed
what is daemon threads
finishing a thread
doubt about garbage collection
daemon thread & user thread
byte array and garbage collection

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture