Memory Leak: Difference between revisions

From COMP15212 Wiki
pc>Yuron
No edit summary
gravatar W81054ch [userbureaucratinterface-adminsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmludGVyZmFjZS1hZG1pbjxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
m (1 revision imported)
 
(No difference)

Latest revision as of 10:03, 5 August 2019

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.