Posts

Showing posts from 2020

Understanding Garbage Collector in Java Part#2

           In this blog we will continue about GC and it's types Types of Garbage Collections: Serial collector: it runs in single Parts. Concurrent Collector: it runs as the application run, and it doesn't wait for old generation memory to be full. A parallel Collector: it starts to run when the heap is full, is consume multiple of you CPU to  perform. When to use: Concurrent Collector: there is more Memory. high Numbers of CPU’s. Application Demands short pauses. Parallel Collector: less Memory. less numbers of CPU’s. the application demands high through put, and can withstand pauses. Types of operations: MARK : go to root Node and marks all the objects are reachable and mark it as live. Mark & Sweep : mark the unreachable objects and deletes it. Compacting ; compact memory by moving around the objects to f

Understanding Garbage Collector in Java Part#1

       before java language, developers used to allocate and DE-allocated memory, in order to free it, if developers didn’t do that operation it will cause a memory leak, that may cause the application to crash or get slow, When java came, it came with automatic memory management called (Garbage Collections), and it works behind the scenes in the background.         The objects are allocated in Heap of java memory, when the GC can’t allocated a new coming Objects, you will get an Error java.lang.OutOfMemoryError , which means that there is no enough Heap space memory. What are Garbage Collector main Job? Identify & Reclaim abandoned Objects. Reducing Applications Pause Time. How Garbage Collector works? - Simplify explanations, the GC remove objects that are not used anymore, by categorize it in two shaped: Dead objects (unreachable Objects). live object : (reachable objects). My Application