Investigating Memory Results > Tuning Garbage Collection and Finding Over-allocations >  Understanding Garbage Collection Issues  

Understanding Garbage Collection Issues

Garbage collection will always have some impact on your program, and the type of garbage collector affects the impact. Some garbage collectors can cause long pauses that are noticeable (and annoying) in programs with graphical user interfaces, but acceptable in server applications. Others minimize the pause time, but this can lower the throughput of server applications.

Modern JVMs use “ergonomics” to try to adapt garbage collector behavior automatically to work best with your program. They may allow you to specify a goal (such as low pause times or high throughput) and will pick an appropriate garbage collection strategy. Often this automatic behavior is good enough.

One key to achieving good GC behavior that is common to all JVMs is correct sizing of the Java heap. Many collectors are “generational” garbage collectors, because they divide the heap into pools for newly allocated objects and older objects that use different garbage collection strategies. Getting the relative sizes of the generations right is also important for good overall garbage collector performance.

An important tool for tuning garbage collection is the Runtime Summary view. This view is available when running a session with the JProbe Console outside of Eclipse. For more information, see <jprobe_install_dir>/doc/JProbeUserGuide.pdf.