Assume I want to allocate only 256 bytes memory blocks
char * memory = new char[256];
than I use placement new to create a FooBar object (sizeof(Foobar)<=256)
FooBar * obj = new (memory) FooBar();
does
delete obj; //this also calls the destructor of FooBar
delete all the 256 bytes of memory?
Does the standard guarantee that the whole "memory" buffer is deallocated by just "deleting obj"? Or it is based on the type "FooBar" and therefore this operation has undefined behaviour?
Assumption: FooBar is the only object in the memory buffer.
This is not duplicate question, please first understand the question. It is not immediately evident what this code does.