October 2004
Beginner
408 pages
9h 24m
English
You already read that it is an error if a block of memory is allocated but never returned to the pool. Such a block will be freed only when the program terminates. If the program runs for a long time and continuously allocates new blocks while forgetting to give old unused blocks back to the pool, then the program will run out of memory at some point, causing subsequent malloc() requests to fail.
If a program has such a bug, it is said to have a memory leak, because the pool of available memory has a leak in it (Figure 10.13).
The address returned by malloc() is the ...
Read now
Unlock full access