I understand that, when we write delete []
on a pointer created by a corresponding new []
, the program will look for the accounting information on the array and find out the array's element size (a counter). Then the program invokes the element's destructor on each of them. Finally memory (what memory??) is deallocated by a function named operator delete
.
What I am asking is whether delete[]
will deallocate the entire memory, allocated by the new[]
expression, in one shot because that information (total amount of memory) is available after all elements are destroyed, or will it successively deallocate the memory occupied by the array elements that it has invoked destructors on?
A related follow-up quesion is asked Does delete (non array form) know the total amount of memory allocated by either new or new[]