0

Can someone tell me on, what exactly happens after Garbage collection is performed?

What I have noticed is while a garbage collection, server goes slow for long time. At times, restart is the only way to regain a healthy server. Or, are there any better solutions or tuning recommended.Please explain.

TuneIt
  • 572
  • 2
  • 9
  • 20
  • Memory is freed after GC. By the way, what is garbage collection server? – codingenious Oct 08 '15 at 18:31
  • 1
    @Batty I think she missed a comma - "*What I have noticed is while a garbage collection **,** server goes slow for long time*" – hagrawal7777 Oct 08 '15 at 18:32
  • I have observed this in - TCServer/JBOSS/Apache Tomcat/Websphere server. Memory gets free yes.. But as per your observation, does the server need restart? Or, it just works fine? – TuneIt Oct 08 '15 at 18:34
  • You should read the multitude of posts and answers on this topic on SO before asking a very broad question. Once could start [here](http://stackoverflow.com/questions/17009961/understanding-the-java-memory-model-and-garbage-collection) – Shawn Mehan Oct 08 '15 at 18:36
  • 3
    Possible duplicate of [How can I avoid garbage collection delays in Java games? (Best Practices)](http://stackoverflow.com/questions/2484079/how-can-i-avoid-garbage-collection-delays-in-java-games-best-practices) – Shawn Mehan Oct 08 '15 at 18:36
  • 1
    you may want to read https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/ and https://github.com/chewiebug/GCViewer – the8472 Oct 08 '15 at 18:37
  • 5
    If your system doesn't go back to normal speed after garbage collections happen, your code has a memory leak somewhere. Garbage collection should be a normal part of your server's operation. – Louis Wasserman Oct 08 '15 at 18:37
  • Garbage Collection happens at a very fast pace. If your code is taking is taking a lot of time during garbage collection while execution it will mean you have a memory leak. Most common mistake using String concatenation rather than using StringBuilder. – Acewin Oct 08 '15 at 19:05

0 Answers0