Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sathish sanigneni
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12123
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic