What flavors of garbage collectors are implemented in the HotSpot virtual machine
The Java HotSpot VM provides developers with four different garbage collectors to choose from:
- Serial is the easiest option for applications with low data volume and low latency requirements. At the moment, it is used relatively rarely, but on weak computers it can be selected by the virtual machine as the default collector. The use of Serial GC is enabled with the -XX:+UseSerialGC option.
- Parallel - inherits assembly approaches from the sequential collector, but adds parallelism to some operations, as well as the ability to automatically adjust to the required performance parameters. The parallel collector is enabled with the -XX:+UseParallelGC option.
- Concurrent Mark Sweep (CMS) - aims to reduce maximum latency by performing some of the garbage collection work in parallel with the main threads of the application. Suitable for dealing with relatively large amounts of data in memory. The use of CMS GC is enabled with the -XX:+UseConcMarkSweepGC option.
- Garbage-First (G1) - designed to replace CMS, especially in server applications running on multiprocessor servers and handling large amounts of data. G1 is enabled with Java option -XX:+UseG1GC.
Read also:
- What is a garbage collector for in Java
- Heap and Stack memory in Java
- How does the garbage collector work in Java
Comments
Post a Comment