https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96942
--- Comment #34 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Dmitriy Ovdienko from comment #26) > According to requirements to the task, I cannot implement my own memory > arena. So I have to find way how to use STL to achieve same effect. I assume you can't just preallocate a buffer for the pool? std::unique_ptr<std::byte[]> bytes(new std::byte[poolSize(stretch_depth)]); // Alloc then dealloc stretchdepth tree. int count = 0; for(int i = 0; i < 20; ++i) { // num_nodes = 0; MemoryPool store (bytes.get(), poolSize(stretch_depth)); Here store.release() will reuse the original buffer supplied to the constructor, so it never actually allocates.