Java / JDK, JRE, JVM, JIT
Explain CMS Garbage Collector in Java.
Concurrent Mark Sweep (CMS) garbage collector uses multiple threads to scan the heap memory to mark instances for eviction and then sweep the marked instances. CMS garbage collector holds all the application threads in the following two scenarios only,
- While marking the referenced objects in the tenured generation space.
- If there is a change in heap memory in parallel while doing the garbage collection.
CMS collector uses more CPU to ensure better application throughput. If we can allocate more CPU for better performance then CMS garbage collector is the preferred choice over the parallel collector.
Turn on the XX:+USeParNewGC JVM argument to use the CMS garbage collector.
More Related questions...