What are uses of the C++ construct “placement new”?

It allows you to do your own memory management. Usually this will get you at best marginally improved performance, but sometimes it’s a big win. For example, if your program is using a large number of standard-sized objects, you might well want to make a pool with one large memory allocation.

This sort of thing was also done in C, but since there are no constructors in C it didn’t require any language support.

Leave a Comment