How can memory leak occur in c++

memory leaks occur when memory allocated by the program is not returned to the operating system.

As time passes, more and more memory is consumed, and eventually the program (or the operating system!) crashes.