You can choose 1 of the 5 available garbage collectors, one of them is Serial GC:
The simplest GC implementation, it works with a single thread for garbage collection process. As a result, it freezes all application threads when it runs, but on the other hand it’s effective in a way that it doesn’t need to communicate between threads. Thus, it's not a good idea to use it in multi-threaded applications, like server environments. The best idea is to use it in a single processor machines, although it can be useful on multiprocessors for applications with small data sets (up to approximately 100 MB).
Default is Parallel GC.
TODO link ParallelGCThreads, MaxGCPauseMillis , GCTimeRatio, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms, UseParallelGC, USeParNewGC, UseG1GC, 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.