Reading Effective C++ by Scott Meyers, and Item 16 claims that when an array is created, the compiler reserves a block of memory at the very beginning to indicate how many objects are in the array.
n = number of objects
|n|index0|index1|...etc
Scott Meyers wrote:
This is just an example, of course. Compilers aren't required to implement things this way, though many do.
Supposedly, this how delete knows how many objects to destruct. And if you were to do something like:
1 2 3
int* foo = newint;
//Stuff
delete[] foo;
Then delete would interpret the first block as the number of items to destruct, then continue on and destruct that many blocks of memory onward, causing UD behavior.