Chapter 4. Memory Management Debugging

In this chapter

Dynamic memory allocation seems straightforward enough: Memory is allocated on demand—using malloc() or one of its variants—and memory is freed when it’s no longer needed. Memory management would be that easy if programmers never made mistakes. Alas, we do make mistakes (from time to time), so memory management problems do occur.

For example, a memory leak occurs when memory is allocated but never freed. Leaks can obviously be caused by a malloc() without a corresponding free(), but leaks can also be inadvertently caused if a pointer to dynamically ...

Get Linux® Debugging and Performance Tuning: Tips and Techniques now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.