How to invoke aligned new/delete properly?
问题 How do I call new operator with alignment? auto foo = new(std::align_val_t(32)) Foo; //? and then, how to delete it properly? delete(std::align_val_t(32), foo); //? If this is the right form of using these overloads, why valgring complaining about mismatched free()/delete/delete[]? 回答1: exist very basic principle - the memory free routine always must match to allocate routine. if we use mismatch allocate and free - run time behavior can be any: all can be random ok, or crash by run-time, or