Leakage
The golden rule for dynamic memory is to free the memory you allocate.
Memory leakage is the term used to describe the situation where one fails to do so. The programmer thinks that the memory region has indeed been freed up. But it has not—that's the bug. Therefore, this makes the thought-to-be-freed memory region unavailable to the process and system; in effect, it is unusable, even though it should have been usable.
The memory is said to have leaked out. So why can't the programmer just take care of this elsewhere in the code by calling free upon this memory pointer? That's really the crux of the issue: in the typical case, because of the way the code is implemented, it's essentially impossible to regain access to that leaked memory ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access