Overloading new and delete

In this lesson, we will learn how to overload the new and delete operators so that we can manage memory in a better way.

Quite often, a C++ application allocates memory but does not deallocate it. This is a job for the operator new and operator delete. Thanks to both of them, we can explicitly manage the memory of an application.

From time to time, we have to verify that an application correctly releases its memory. In particular, for programs running for long periods of time, it is a challenge to allocate and deallocate memory from a memory management perspective. Of course, the automatic release of memory during program shutdown is not an option.

The baseline #

As a baseline for our analysis, we use a simple program that frequently allocates and deallocates memory.

Get hands-on with 1400+ tech skills courses.