You are here : Home / Core Java Tutorials / Series of JVM and Garbage Collection (GC) in java - Best explanations ever
In this core java tutorial we will learn about Serial GC (Garbage collector) in java.
Contents of page >
- Serial collector / Serial GC (Garbage collector) in java
- Features of Serial GC (Garbage collector) in java >
- When to Use the Serial GC (garbage Collector) in java >
- Vm (JVM) option for enabling serial GC (garbage Collector) in java >
-XX:+UseSerialGC
Serial collector / Serial GC (Garbage collector) in java
Features of Serial GC (Garbage collector) in java >
- Serial collector is also called Serial GC (Garbage collector) in java.
- Serial collector is simply also called Serial collector in java.
- Serial GC (Garbage collector) is rarely used in java.
- Serial GC (Garbage collector) is designed for the single threaded environments in java.
- In Serial GC (Garbage collector) , both minor and major garbage collections are done serially by one thread (using a single virtual CPU) in java.
- Serial GC uses a mark-compact collection method. This method moves older memory to the beginning of the heap so that new memory allocations are made into a single continuous chunk of memory at the end of the heap. This compacting of memory makes it faster to allocate new chunks of memory to the heap in java.
- The serial garbage collector is the default for client style machines in Java SE 5 and 6.
When to Use the Serial GC (garbage Collector) in java >
- The Serial GC is the garbage collector of choice for most applications that do not have low pause time requirements and run on client-style machines. It takes advantage of only a single virtual processor for garbage collection work in java.
- Serial GC (garbage collector) is also popular in environments where a high number of JVMs are run on the same machine. In such environments when a JVM does a garbage collection it is better to use only one processor to minimize the interference on the remaining JVMs in java.
Vm (JVM) option for enabling serial GC (garbage Collector) in java >
-XX:+UseSerialGC
Example of Passing Serial GC in Command Line for starting jar>
java -Xms256m -Xms512m -XX:+UseSerialGC -jar d:\MyJar.jar
Summary -
So in this core java tutorial we learned about Serial collector / Serial GC (Garbage collector) in java. We learned Features of Serial GC (Garbage collector) in java. Also When to Use the Serial GC (garbage Collector) in java. And Vm (JVM) option for enabling serial GC (garbage Collector) in java.
Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.
RELATED LINKS>
Different type of garbage collectors in java>
>Throughput GC (Garbage collector) or Parallel collector in java
>Concurrent Mark Sweep (CMS) collector / concurrent low pause garbage collector in java
>G1 garbage collector / Garbage first collector in java
>PS Scavenge and PS MarkSweep
Different between garbage collectors in java>
>Difference between Serial GC vs Throughput GC (Garbage collector) in java
Default garbage collector in java >
>What is default garbage collector for Java 7, 8 and 9
Apache tomcat server,outOfMemory and Garbage collection in java >
>How to set or change permgen size in tomcat server, eclipse?
>How to set, change, increase or decrease heap size in tomcat server and eclipse to avoid OutOfMemoryError ?
>How to pass VM argument to tomcat in eclipse
Pass VM para through CMD, eclipse to java program and to Apache tomcat >
>How to write java program to pass VM/JVM parameters through CMD
>How to pass vmArgs(JVM parameters) to java program in eclipse
>How to pass VM argument to tomcat in eclipse
Labels:
Core Java
Garbage collection in java