When a program fails to eventually deallocate a block of memory that it has dynamically allocated from the heap, this is known as a memory leak .
Memory leaks are very bad for a variety of reasons.
If the program continually takes memory from the heap without ever returning it, the heap will eventually run out of memory. If you are working with an operating system that virtualizes memory, the system will slow down more and more as the onboard memory resources are leaked away. The OS will have to resort to swapping memory back and forth between RAM and the hard drive to satisfy the constant demand for new memory allocations.