DEV Community

javaknowledgehub
javaknowledgehub

Posted on

Memory Leak - Explained

When a computer program fails to release a memory that is no longer in use, this condition is known as a memory leak. As a result, that particular block of memory is always occupied, which could have been used by other computer programs.

Java Garbage Collector and Memory Leak in Java
One of the benefits of Java is that it provides out-of-the-box memory management. A programmer decides when to allocate memory in a program, while the inbuilt Java garbage collector takes care of deallocating it. The garbage collector automatically scans the memory and looks for objects that cannot be directly/indirectly accessed from variables in code. These kinds of memory blocks are deallocated and memory is freed.

Checkout full article here

Top comments (0)