This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage collection Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Garbage collection Question" Watch "Garbage collection Question" New topic
Author

Garbage collection Question

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
Need little advise on Garbage collection,

I have heard that whenever the gc process is running, we try to do some other process, it will not execute unless the gc process is complete.

Please let me know if iam correct or wrong.
If wrong, need little details and explaination on the same.


Thanks<br />Dinesh
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1278

Hi Dinesh,

the garbage collector of Java runs as a background daemon in a special thread whenever the JVM is started. Of course it regularly has to do it's job so it obviously consumes resources like CPU power. On a single processor system it's clear that there's no chance for other threads to proceed if the garbage collector thread is active because there's no real multi threading on such system. But unlike earlier version of Java and the JVM the garbage collector is really, really clever and you don't notice it doing its work in normal applications. It would be no problem to provoke lags in your program flow by allocation and deallocation enormous amounts of memory without sense but this would also lead to inefficiencies in programming languages without garbage collector.

Marco
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage collection Question
 
Similar Threads
Garbage collection.
Duration For H1B
islands of isolation in Garbage Collection
Return values of methods
objects eligible for gc