Memory leak

A memory leak occurs when a program loses track of allocated memory without freeing it.

This typically occurs in non-garbage collected languages, where the language runtime does not gather up discarded memory for re-use. Instead, memory that is never explicitly freed is never made available to the allocator, effectively reducing the total amount of memory, as if it were leaking out of the computer.

In C, when an auto (local) pointer to a location on the heap goes out of scope, the heap memory is still marked as used by the memory allocator, but the program cannot ever get it back. Over time, a leaky process's memory usage will climb, and eventually the process will have to be restarted or risk thrashing.