aspose 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
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: 10916
    
  12

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

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 - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What will happen if the Garbage collection process is running frequently?
 
Similar Threads
Q on finalize() method
Garbage Collection
Garbage Collection
garbage collection too frequently or too long
Garbage Collection - Boone's Mock Q