• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage Collector

 
chintan shah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can a daemon thread outlive the main thread that created and turned it to daemon?
Also,
It is said that garbage collector is a daemon thread used by JVM.
can anyone tell where and when it is spawned?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, daemon threads can live longer than the thread that created them, as long as there is at least one other non-daemon thread in the JVM. There's no special link between the daemon thread and its creator.

The garbage collector thread, along with several other special-purpose threads, are all created when the JVM starts up, before any of your code is invoked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic