Remember that C ++ separates memory allocation and object expression. By default, an array-new expression T * p = new T[N];allocates enough memory for objects Nand constructs these objects. At the other end delete[] p;should call the destructor of all these elements, and then free the memory.
, , . -, ++ , N * sizeof(T). , p N, p , . (, p , .)
. ; , Itanium ABI ( cookie) , new T[N] :
+- alignof(T) --+-- sizeof(T) --+-- sizeof(T) --+-- sizeof(T) --+-- ...
| ***** [8B: N] | 1st element | 2nd element | 3rd element | .....
+---------------+---------------+---------------+---------------+-- ...
A A
| |_ result of "new T[N]"
|
|_ value returned "operator new[]()"