Memory Leak

A memory leak is a type of programming error that causes a program to slowly consume system memory until none is left. A memory leak happens slowly, causing computer performance to gradually degrade until the program crashes or the entire operating system freezes. Quitting the program responsible for the leak frees up the system's memory and resolves the problem until the next time the program runs.

Memory leaks happen when a program fails to release memory after it no longer needs it. When a program runs a process, it requests an amount of memory from the system to run that process. After that process finishes, the program should release that memory back to the system so that other programs may use it. If the program does not include the correct functions that free up memory (or those functions aren't used correctly), it will instead hold on to that memory indefinitely. When the program runs that process again later, it requests more memory from the system instead of using the memory it had already allocated, increasing the amount of RAM it uses until the system has nothing left for other functions.

A program that suffers from a memory leak will continue to leak memory every time it runs until the error is fixed. Thankfully, software development kits often include debuggers that can check a program's source code for memory leaks. Once the program's developer finds the error, they can update the program and release a patch.

NOTE: Some programming languages like Java and Python use a memory management technique called "garbage collection" that automatically reclaims memory and can resolve many (but not all) memory leak errors.

Updated October 25, 2023 by Brian P.

quizTest Your Knowledge

Which of the following is a type of data structure?

A
Heap
0%
B
Mound
0%
C
Bump
0%
D
Divot
0%
Correct! Incorrect!     View the Heap definition.
More Quizzes →

The Tech Terms Computer Dictionary

The definition of Memory Leak on this page is an original definition written by the TechTerms.com team. If you would like to reference this page or cite this definition, please use the green citation links above.

The goal of TechTerms.com is to explain computer terminology in a way that is easy to understand. We strive for simplicity and accuracy with every definition we publish. If you have feedback about this definition or would like to suggest a new technical term, please contact us.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe or change your frequency setting at any time using the links available in each email.

Questions? Please contact us.