What are the changes in Memory Management in Java 9?
Garbage Collection or simply GC is the core part of Memory Management in Java. It can be responsible for cleaning dead objects from memory and reclaiming that space. GC executes cleanup using predefined Garbage Collectors that uses certain algorithms.
There are a few important types of Garbage Collectors listed below
- Serial GC: A single thread collector and applies to small applications with small data usage. It can be enabled by specifying the command-line option: -XX:+UseSerialGC.
- Parallel GC: Parallel GC uses multiple threads to perform the garbage collecting process, and it's also known as the throughput collector. It can be enabled by explicitly specifying the option: -XX:+UseParallelGC.
- G1 Garbage First: G1 (Garbage First) is the default garbage collector in Java 9. It can be designed for applications running on multi-processor machines with large memory space. It can be enabled with the option: -XX:+UseG1GC.
- Concurrent Mark Sweep: The application pause time is kept to a minimum. It can be used by specifying the option: -XX:+UseConcMarkSweepGC. As of Java 9, this GC type is deprecated.
Published on 03-Apr-2020 14:09:51