Understanding the Java garbage collection policies
Garbage collection is one of the features that characterize the Java language; it went through continuous improvements in the subsequent Java releases. We have the following three main types of garbage collectors:
- Serial collector: This collector does the garbage collection in a serial (sequential) manner, followed by compacting the old space to combine the empty space for better object allocations later. This means the application will be stopped during this collection activity.
- Concurrent mark sweep (CMS): This collector runs in parallel in two different stages—the mark stage to mark the objects that are eligible for garbage collection (three steps) and the sweep stage to remove these objects. ...