A memory leak occurs when an application fails for some reason to release dynamic memory that was allocated using new or malloc().The application won’t reclaim the allocated memory because both C and C++ assume that if you don’t explicitly free dynamically-allocated memory, you want it to remain available throughout the lifetime of the application. Some operating systems reclaim the leaked memory but they do that only after the application has terminated. On other operating systems (DOS, for example) leaked memory is lost until the system is rebooted. In either case, recurrent memory leaks cause an application to bog down or crash altogether. The easiest way to avoid memory leaks is by not using dynamic allocations in the first place. If possible, the application should use automatic and static storage instead of dynamic memory. When dynamic memory allocation is unavoidable, remember to add a matching delete call for every object allocated by new.