Possible Duplicate:
How does delete[] “know” the size of the operand array?
In the following sample code :
int* p = new int[10];
delete[] p;
how does it know how many elements are to be deleted ?
I heard that this info is stored in a kind of header before the start of the table that have been allocated or somewhere else - but in this case, why can't we access this value with a function like size(p) which would return 10 ? Is-there any particular reason for it ? What other informations are stored in these headers ? Is it OS specific? Compiler specific ?
Thanks