Foo* set = new Foo[100];
// ...
delete [] set;
You don\'t pass the array\'s boundaries to delete[]
. But where is that information stor
It is not standardized. In Microsoft's runtime the new operator uses malloc() and the delete operator uses free(). So, in this setting your question is equivalent to the following: How does free() know the size of the block?
There is some bookkeeping going on behind the scenes, i.e. in the C runtime.