Garbage Collection in Java - What is GC and How it Works in the JVM

theawesomenayak

Siben Nayak

Posted on January 23, 2021

Garbage Collection in Java - What is GC and How it Works in the JVM

Garbage Collection is the process of reclaiming the runtime unused memory by destroying the unused objects.

In languages like C and C++, the programmer is responsible for both the creation and destruction of objects. Sometimes, the programmer may forget to destroy useless objects, and the memory allocated to them is not released. The used memory of the system keeps on growing and eventually there is no memory left in the system to allocate. Such applications suffer from “memory leaks”.

Java Garbage Collection is the process by which Java programs perform automatic memory management. Java programs compile into bytecode that can be run on a Java Virtual Machine (JVM).

Garbage collection makes Java memory-efficient because it removes the unreferenced objects from heap memory and makes free space for new objects.

The Java Virtual Machine has many types of garbage collectors.

In these videos, I’ve discussed the Garbage Collection in Java, how it works, and the various types of collectors available.

Please subscribe to the channel and like the video if you find it helpful.

💖 💪 🙅 🚩
theawesomenayak
Siben Nayak

Posted on January 23, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related