As you may know, dynamically allocated memory (DAM) is memory that a program requests from the heap with functions like
calloc(). Dynamically allocated memory is typically used for data structures like binary trees and linked lists, and it is also at work behind the scenes when you create an object in object-oriented programming. Even the standard C library uses DAM for its own internal purposes. You may also recall that dynamic memory must be freed when you're done with it.
DAM problems are notoriously difficult to find and fall into a few general categories:
Dynamically allocated memory is not freed.
The call to
malloc() fails (this is easy to detect by checking the return value of