Memory leaks happen frequently in programming languages like C/C++. We can check for memory leaks with Valgrind.
There’s a few instances where they could happen:
- We access an array index or memory address that’s out of bounds.
- We forget to free dynamically allocated memory.