What is placement new?

What is placement new?

The placement-new operator constructs an object on a pre-allocated buffer. The pre-allocated buffer has to be allocated on the heap. Operator new allocates memory from the heap, on which an object is constructed. Standard C++ also supports placement new operator, which constructs an object on a pre-allocated buffer. This is useful when building a memory pool, a garbage collector or simply when performance and exception safety are paramount.

By:UMANG
Date:2007-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Subjective Links

C Subjective interview questions and answers for experienced and fresher