10. Memory Management

No amount of genius can overcome obsession with detail.

traditional

The need for fine-grain control of allocation and deallocation — separating allocation and initialization — array allocation — placement — deallocation problems — memory exhaustion — handling memory exhaustion — automatic garbage collection.

10.1 Introduction

C++ provides the operator new to allocate memory on the free store and the operator delete to release store allocated this way (§2.11.2). Occasionally, a user needs a finer-grained control of allocation and deallocation.

An important case is a per-class allocator for a frequently used class (see [2nd,pg 177]). Many programs create and delete large numbers of small objects of a few important classes ...

Get The Design and Evolution of C++, First Edition 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.