aspose file tools*
The moose likes Beginning Java and the fly likes Garbage Collector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Garbage Collector" Watch "Garbage Collector" New topic
Author

Garbage Collector

chintan shah
Greenhorn

Joined: Oct 05, 2008
Posts: 7
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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.


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Garbage Collector