you can ask the opposite: when should you use the strange first option? basically, if you want to allocate a large object, because if you do not need to do this, and you can put it on the stack, this will be a much faster option: this is one of the main advantages of using C ++ over JAVA, which puts all objects on the heap. and this advantage is especially true when working with many, many selections of small objects: put them on the stack to increase speed. the overhead of posting a pointer to the difference. You can find here information about the extended pool library, which provides us with tools to manage such allocations.
source share