General Suggestions for Better GC Performance

This section describes some general rules used by JVM to manage memory and get better GC performance.

We know that one strength of JVM (Java Virtual Machine) is that it performs automatic memory management for us. But this also could also give us headaches when JVM throws OutOfMemoryError at us, because we don't have much direct control on how memory is managed.

The only thing we can do is to learn how JVM memory management works, write Java code better aligned with the JVM memory management design, and play with JVM memory management parameters for better result. Here are my understandings of HotSpot memory management and suggestions on to minimize memory usage and maximize performance for your Java applications:

Table of Contents

 About This Book

 Heap Memory Area and Size Control

 JVM Garbage Collection Logging

 Introduction of Garbage Collectors

 Serial Collector - "+XX:+UseSerialGC"

 Parallel Collector - "+XX:+UseParallelGC"

 Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"

 Garbage First (G1) Collector - "+XX:+UseG1GC"

 Object References and Garbage Collection

 Garbage Collection Performance Test Program

 Performance Tests on Serial Collector

 Performance Tests on Parallel collector

 Performance Tests on Concurrent collector

 Performance Tests on G1 collector

Garbage Collection Performance Test Summary

 Best Garbage Collector and Configuration

General Suggestions for Better GC Performance

 Archived Tutorials

 References

 Full Version in PDF/EPUB