A Memory leak occurs when we create a memory in heap areas and forget to delete it. And it also happens when we create any objects multiple times and we can’t accessed by the running source code.
And the most powerful disadvantage of memory leak is, it reduces the performance of the computer system and also waste the space of memory.
Here is the C Language example where we can demonstrate the concept of memory leak.
Code for allocation of Memory Leak
#include <stdlib . h>;
{
...................
..................... // Write some code here
....................
}
Code for avoiding Memory Leak allocated on heap area.
#include <stdlib . h>;
{
.................
................... // Write some code here
...................
}