jQuery in Action, 3rd edition
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

Garbage Collector

chintan shah

Joined: Oct 05, 2008
Posts: 7
can a daemon thread outlive the main thread that created and turned it to daemon?
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

Joined: Jul 08, 2003
Posts: 24193

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]
I agree. Here's the link: http://aspose.com/file-tools
subject: Garbage Collector
It's not a secret anymore!