View RSS Feed

Core Java

Types of Garbage Collector in Java

Rate this Entry
by , 03-02-2012 at 05:31 PM (14703 Views)
Java Runtime provides various Garbage collection types in Java. One may choose them according to the requirements of performance of your application. In Java 5, three garbage collectors are added except “serial” garbage collector. Each garbage collector is implemented to raise the throughput of application or to reduce the garbage collection’s pause time.

1) Throughput Garbage Collector:
Garbage collector used parallel version of the Young generation collector. JVM, -XX:+UseParallelGC option passes via command line, then it is used.Serialcollector and tenured generation collector are same.

2) Concurrent low pause Collector:

This collector is used when–Xingc or -XX:+UseConcMarkSweepGC pass on command line. Also, it is called “Concurrent Mark Sweep Garbage collector”. Concurrent collector collects tenured generation.Majority of collection gets done with the execution of application. For shorter time duration application is paused during collection. Parallel version of the young generation copying collector and concurrent collector are used along. Concurrent Mark Sweep Garbage collector is widely used in Java. Object required to be collected is 1st marked by algorithm when you trigger garbage collection.

3) The Incremental (Sometimes called train) low pause collector:

Use this collector when -XX:+UseTrainGC passes on command line. Since Java 1.4.2, change has not come in garbage collector. It shall not be used it will not be supported in the future releases.
Don’t use -XX:+UseParallelGC and -XX:+UseConcMarkSweepGC together.

Submit "Types of Garbage Collector in Java" to Facebook Submit "Types of Garbage Collector in Java" to Digg Submit "Types of Garbage Collector in Java" to Submit "Types of Garbage Collector in Java" to StumbleUpon Submit "Types of Garbage Collector in Java" to Google