• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Daemon thread

 
muthu muruges
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether the daemon thread will be GCed if it comes out the run method provided the main thread keep on running?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Well as usualy, there are no guarantees regarding GC, and if you have saved a reference to the thread somewhere, you certainly my prevent GC. But in general, once a thread completes its run method it will be eligible for GC (unless there are other references somewhere). Being a daemon thread does not change this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic