DEV Community

Discussion on: Explain a "memory leak" like I'm five

Collapse
kjwong3 profile image
Kelly Wong • Edited on

Imagine you and your friends have some soccer balls. Every time one of you want to go play soccer, you get a ball, play with it, and bring it back. As long as everyone remembers to bring their ball back, you and your friends can play soccer as much as you want.

Now imagine you or your friends sometimes forget to bring a ball back. Eventually, all the balls get lost, and no one can play soccer anymore.

Memory in a computer is something all programs need to work. A memory leak is like when you forget to bring the soccer ball back. If a program doesn't put its memory back, then none of the programs can work anymore.