Monday, 3 February 2014

What is Garbage collector in java and how it works?

Java is a language with automatic memory management. This was controlled by Garbage collector .Garbage collection is a process of marking unrefereed objects or unused object and removing them and making memory occupied by them available  to other new requirement. Unused objects ate those which are no more needed by the java application and do not contain any reference from application.

According to JDK 7, there are 5 GC types.

1.Serial GC
2.Parallel GC
3.Parallel Old GC (Parallel Compacting GC)
4.Concurrent Mark & Sweep GC  (or "CMS")
5.Garbage First (G1) GC

Different JVM uses different algorithms for Garbage collection some are :-

Marking and Sweeping Away Garbage



1.The algorithm traverses all object references, starting with the GC roots, and marks every object found as alive.
2.All of the heap memory that is not occupied by marked objects is reclaimed. It is simply marked as free, essentially swept free of unused objects




So instead of finding unused objects it finds the used objects and removes the all thing in left part of memory.


But the logical memory leaks cannot be determines by any software or any tools used for leak detection . What at maximum level they can do is they can mark the suspicious object and can suggest that they may be the culprit for memory leak.  

You may also like:-

How to Reduce Garbage-Collection Pause Time?

4 Mains causes of Long Garbage Collection Pause?

How Application Performance get impacted by Garbage Collection?

Java Performance Tuning options Java heap

Why Memory leak in Java ?

What is a Memory Leak in java?

What is Garbage collector in java and how it works?

What is Garbage Collector Compaction in Java?

What are Java heap Young, Old and Permanent Generations?

What is difference between Web Server and Application Server ?

What is the maximum ram for 32 bits and 64 bits computer?

Some Amazing fact about memory (petabyte,exabyte,zettabyte) And How much data exists on the Web?

No comments:

Post a Comment

Hemant Kurmi - 2021 - Some Amazing Facts About Memory: Petabyte, Exabyte, and Zettabyte

Some Amazing Facts About Memory: Petabyte, Exabyte, and Zettabyte As technology advances, our ability to store and process data has grown ...