memory leak
/ˈmem.ər.i liːk/noun
A memory leak is a software bug in which a program retains memory it no longer uses. Memory usage can keep growing while the program runs.
Because of the memory leak, the service used so much memory after a few days that it needed a restart.
A program allocates memory for objects, images and temporary calculations, for example. Once the data is no longer needed, that memory should become available again. A memory leak prevents this. If the same fault keeps recurring, memory usage grows and the software can slow down, freeze or be stopped by the operating system.
Why does memory remain occupied?
In languages with manual memory management, a program may forget to release allocated memory. Automatic garbage collection prevents this for many objects but does not rule out memory leaks. An object remains in memory while the program can still reach it. An unintended reference from a cache, event listener or global variable can retain data the application no longer uses.
High memory usage alone is not a memory leak. A program may deliberately need a lot of memory and release it later. A leak keeps memory occupied unnecessarily, often after a repeated action.
How do you find a memory leak?
Glossary · In briefmonitoringMonitoring systematically tracks software, infrastructure or processes through measurements and checks. Deviations can trigger alerts so an administrator can investigate.Read more can show memory usage continuing to rise over time. To find the cause, developers compare memory snapshots or use a profiler. They investigate which objects remain and which references keep them reachable.
The solution depends on the cause. Code may need to remove an event listener, limit a cache or clear a reference. A developer then checks whether memory usage stabilizes under the same load.