In the C++ programming language, placement syntax allows programmers to explicitly specify the memory management of individual objects — i.e. their "placement" in memory. Normally, when an object is created dynamically, an allocation function is invoked in such a way that it will both allocate memory for the object, and initialize the object within the newly allocated memory. The placement syntax allows the programmer to supply additional arguments to the allocation function. A common use is to supply a pointer to a suitable region of storage where the object can be initialized, thus separating memory allocation from object construction.
The "placement" versions of the
delete operators and functions are known as placement
new and placement
new expression, placement or otherwise, calls a
new function, also known as an allocator function, whose name is
operator new. Similarly, a
delete expression calls a
delete function, also known as a deallocator function, whose name is
new expression that uses the placement syntax is a placement
new expression, and any
operator new or
operator delete function that takes more than the mandatory first parameter (std::size_t and void *, respectively) is a placement new or placement delete function.