C++ Blog

Tuesday, November 29, 2005

Uses of Placement new operator

1) It is used to create a memory pool or buffer
2) Useful in system programming like shared memory, memory mapped IO etc.,
3) It is helpful in applications where performance and exception safe are important like embedded systems
a. Performance gain is because allocation of objects happens in the pre-allocated buffer so it is fast
b. It is exception safe because you don’t need to worry about allocation failure (since the object is constructed in pre-allocated memory)

0 Comments:

Post a Comment

<< Home