Memory Leak

From COMP15212 Wiki
Depends on Dynamic Memory Allocation

A so-called “memory leak” is a case where dynamically allocated memory is not released when it is finished with. This is normally a result of bad programming practice.

The effect is often that more memory is claimed instead of recycling the existing resource. This will cause a slowdown as a process’ memory ‘footprint’ increases (resulting in extra paging) and, eventually, a crash of that process because there is no more resource for it.

In the worst case, other processes and even the O.S. could crash due to an apparent lack of resource.

Memory leaks are (sadly!) not uncommon in applications processes. An operating system such as Unix also keeps track of the memory allocated to each process and will recover every resource it claimed when it terminates. This makes a leak less likely to be a fatal problem.