title: When thread in Java is removed from memory?
body: <p>From the Java API doc:</p>
  
  <blockquote>
    <p>The Java Virtual Machine continues to execute threads until following
    occurs:</p>
    
    <p>All threads that are not daemon threads have died, either by returning
    from the call to the run method or by throwing an exception that
    propagates beyond the run method.</p>
  </blockquote>
  
  <p>I hope my assumption is correct that once thread finishes its <code>run()</code> method it becomes eligible for garbage collection. In the same context I am just curious to know about:</p>
  
  <ol>
  <li>If it doesn't become eligible for garbage collection after returning
  from <code>run()</code>, should one set its reference to <code>null</code> to do that?</li>
  <li>Being eligible for garbage collection doesn't necessarily mean that
  the object will be removed from memory. It is at the sole discretion of
  the underlying operating system / JVM when it is garbage collected.
  But how can one make sure (either through a Java program or external tool) that the object is completely removed from
  the memory?</li>
  <li>If a thread is said to be dead once it finishes its run() method, why
  can I still be able to execute <code>isAlive()</code> or <code>getState()</code> on the
  same thread object? Both the calls return <code>false</code> and <code>RUNNABLE</code>
  respectively.</li>
  </ol>