Just thought I'd point out this interesting FAQ entry from Marshall Cline's C++ FAQ Lite:

[16.13] After p = new Fred[n], how does the compiler know there are n objects to be destructed during delete[] p?

Short answer: Magic.

Long answer: The run-time system stores the number of objects, n, somewhere where it can be retrieved if you only know the pointer, p. There are two popluar techniques that do this. Both these techniques are in use by commercial grade compilers, both have tradeoffs, and neither is perfect. These techniques are:

1) Over-allocate the array and put n just to the left of the first Fred object.
2) Use an associative array with p as the key and n as the value.