Ever wondered why Eclipse/Netbeans keeps pausing for a while every now and then? Especially right when you want to show something in the code to your colleagues? It feels pretty embarrassing and awkward, doesn't it?
In short, when GC is running, it pauses execution of the application until it is done freeing the memory. This is for sure unacceptable for real-time systems, where Java is certainly not the number one option. But even in non-critical huge desktop applications, which modern Java IDEs certainly are, the GC may stop the whole application for several seconds. And this may happen several times during the day. You can imagine that with productivity tools like IDEs, this is simply dragging down the "productivity" effect.
A solution is to do some tweaking:
- Increase memory for JVM on which the IDE is running (beware that this only reduces frequency of GC being called, but prolongs the execution time of a single GC run - it takes longer to collect garbage from a bigger pile...)
- Switch default GC engine for a more concurrent engine, which tries to collect garbage continually even between stop-everything-until-done executions of complete GC
You can read more here.