You can choose 1 of the 5 available garbage collectors, one of them is G1:
G1 (Garbage First) GC is designed for apps in multi-processor environments with large memory space (more than 4GB). It is available from the JDK7 Update 4. Unlike other collectors, the G1 collector partitions the heap into a set of equal-sized heap regions (usually 1MB to 32MB) chunks, prioritizes them, and then performs the garbage collection on those chunks based on the priority. When G1 performs garbage collections, it shows a concurrent global marking phase (i.e. phase 1, known as Marking) to determine the live and dead objects in the heap. After the marking phase is finished, G1 knows which regions contains most of garbage. These areas cleared first, which usually yields a significant amount of free space. That is why this GC is called Garbage-First.
Default is Parallel GC.
TODO link ParallelGCThreads, MaxGCPauseMillis , GCTimeRatio, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms, UseSerialGC, USeParNewGC, UseParallelGC, UseZGC
If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.
Edit your Comment