File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes What will happen if the Garbage collection process is running frequently? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Performance
Reply Bookmark "What will happen if the Garbage collection process is running frequently? " Watch "What will happen if the Garbage collection process is running frequently? " New topic
Author

What will happen if the Garbage collection process is running frequently?

sathish sanigneni
Greenhorn

Joined: May 15, 2012
Posts: 7
What will happen if the Garbage collection process is running frequently? Is it good or bad or any performance issues?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 9955
    
    6

Why would it be running frequently?

Any time anything runs (the GC, Diablo III, your browser running Facebook apps), they take time away from the CPU. When the GC runs, it can slow/pause things in your application, but depending on what your application does, you may never notice.

As I understand it, the GC is pretty well tuned. It doesn't run for no reason. If the JVM is running it a lot, you have to ask yourself if you are creating/releasing a bunch of stuff unnecessarily.


Never ascribe to malice that which can be adequately explained by stupidity.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6590
    
    1

Is it good or bad or any performance issues?


GCs can cause the JVM to pause for a while. When the heap is large enough (several GBs) this effect is quite predominant and can even be observed over a few seconds. Yes it is bad for performance. Unless your code churns out many objects for the GC to collect, the GC should not run all that frequently. There are GCs that do not stop the world all at once, but even they have several phases (like compaction) that can take a long time.


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: What will happen if the Garbage collection process is running frequently?
 
Similar Threads
Garbage Collection
Garbage Collection
garbage collection too frequently or too long
Q on finalize() method
Garbage Collection - Boone's Mock Q