Chapter 4. Dynamic Memory Management

with Fred Long, Gerhard Muenz, and Martin Sebor1

1. Fred Long is a senior lecturer in the Department of Computer Science at Aberystwyth University in the United Kingdom. Gerhard Muenz is an instructor and researcher at Siemens AG, Corporate Technology. Martin Sebor is a Technical Leader at Cisco Systems.

By the pricking of my thumbs, Something wicked this way comes. Open, locks, Whoever knocks!

—William Shakespeare, Macbeth, act 4, scene 1

C and C++ programs that operate on a variable number of data elements require the use of dynamic memory to manage this data. The vast majority of non-safety-critical applications use dynamic storage allocation.

Memory management has long been a source of elusive programming ...

Get Secure Coding in C and C++, Second Edition now with O’Reilly online learning.

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