new and delete (C++)

[1] Except for a form called the "placement new", the new operator denotes a request for memory allocation on a process's heap.

The deallocation counterpart of new is delete, which first calls the destructor (if any) on its argument and then returns the memory allocated by new back to the free store.

If new cannot find sufficient memory to service an allocation request, it can report its error in three distinct ways.

[5] new and delete were, in fact, introduced in the first version of C++ (then called "C with Classes") to avoid the necessity of manual object initialization.

The C++ standard library instead provides a dynamic array (collection) that can be extended or reduced in its std::vector template class.

The C++ standard does not specify any relation between new/delete and the C memory allocation routines, but new and delete are typically implemented as wrappers around malloc and free.