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).
Comments
Post a Comment