multithreading - Do java threads get deleted when they finish -
multithreading - Do java threads get deleted when they finish -
say spawn thread every couple seconds using method below , every thread takes sec complete. finished threads deleted?
new thread (new myrunnableclass()).start();
the native, os-level thread released thread finishes (circa when run()
finishes), thread object lives, other object, until becomes unreachable , garbage collector feels running.
edit: might interesting know thread
(in sun's oracle's implementation, anywho) has private method called vm when thread exits, aggressively nulls several fields, including 1 referring runnable
set thread(runnable)
constructor. if retain reference thread
, things doesn't need after finishing execution released, regardless.
java multithreading concurrency
Comments
Post a Comment