Chapter 4 Dynamic Memory Management

with Fred Long1

1. Fred Long is a senior lecturer in the Department of Computer Science at the University of Wales, Aberystwyth, in the United Kingdom.

By the pricking of my thumbs,Something wicked this way comes.Open, locks,Whoever knocks!—William Shakespeare,Macbeth. Act IV, Sc. 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 applications use some form of memory management.

Memory management has always been a source of elusive programming defects, and consequently, a source of security flaws and vulnerabilities. Programming defects in which memory is freed twice, for example, can lead to exploitable vulnerabilities. ...

Get Secure Coding in C and C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.