I am curious how delete[] figures out the size of the allocated memory. When I do something like:
int* table = new int[5]; delete[] table;
My guess is that new[] actually allocates more data than it seems. It probably has a few bytes before the pointer that is returned that tells how many items are in the array.