• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread null  RSS feed

 
Vivian Josh
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

Can someone tell me what happens in the following situation.

Thread t = new Thread(runnableInstance);
t.start();
t = null;

What happens to the t object? Is it available for garbage collection as other java objects or for threads the process is different?


- Vivian
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37462
537
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vivian,
The JVM still has a reference to the thread. Even if you null out yours, the thread will not be garbage collected until it has completed execution (or the JVM shuts down.)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!