Deallocating memory

1
2
int* pi = new int[5];
delete[] pi;


Before deleting pi, it is a pointer to the first int of the array of ints in the memory. pi Does not know to how many objects(ints) it points, right? Then how can the delete[] statement free all the memory(5 ints) that pi points to?
closed account (DSLq5Di1)
http://www.parashift.com/c%2B%2B-faq-lite/freestore-mgmt.html#faq-16.14
Thanks, the explanation is a bit over my head at the moment, but it's nice to know that it's not just "magic".
Topic archived. No new replies allowed.